← Notion Interview Insights

Notion·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Apr 2026

Summary

SQL technical screen for a Data Engineer role at Notion. One question, pretty focused, they wanted to see if you could chain aggregations cleanly and think about edge cases without being prompted.

Questions Asked (1)

Q1

Given an events table and a users table with plan types, write a SQL query that finds the plan type most associated with the single most popular event type.

Product Analytics & MetricsData Modeling
Author's notes

My first instinct was to just join everything and group by both event_type and plan_type at once, which felt cleaner but actually makes the logic murky.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, identify the single most popular event type by counting occurrences in the events table. Then, join the events table with the users table to get the plan type for each event, and count how many times each plan type is associated with that top event type. Finally, return the plan type with the highest count.

Pro tip: Clarify assumptions about ties and data freshness upfront, and mention that you'd validate the result with a quick sanity check (e.g., comparing counts to overall plan distribution) to ensure the association isn't just due to a popular plan.

1. Find the most popular event type

Write a subquery or CTE that groups the events table by event_type and counts occurrences, then orders descending and limits to 1 to get the top event type.

2. Join events with users

Join the events table to the users table on user_id to associate each event with the user's plan type.

3. Filter for the top event type

Apply a WHERE clause to keep only rows where event_type equals the top event type identified in step 1.

4. Count plan types and select the top one

Group the filtered results by plan_type, count the number of events per plan, order descending, and limit to 1 to get the plan type most associated with the top event.

Key Points to Mention

  • Use of CTEs or subqueries for readability and modularity
  • Handling ties: decide whether to return all tied plan types or pick one arbitrarily (e.g., by alphabetical order) and explain the choice
  • Consideration of data volume and performance: indexing on event_type and user_id
  • Assumption that each event has a valid user_id and each user has a plan_type; mention how to handle NULLs or missing data
  • Potential need to filter events by time period (e.g., last 30 days) to reflect current popularity
  • Validation: compare the result to overall plan distribution to ensure the association is meaningful

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.