← Meta Interview Insights

Meta·Data Scientist·Technical Phone Screen·Senior

Senior
Jul 2026

Summary

Meta DS interview with a pretty involved SQL problem covering multi-account users, notification deduplication, and percentage calculations. Two tables, a bunch of edge cases, and they wanted clean ANSI SQL with CTEs.

Questions Asked (2)

Q1

Given a notifications table and a dim_circle_people table, write SQL to return a single row showing how many distinct persons had exactly 2, exactly 3, and more than 3 active accounts during August 2025. An account counts as active if its last_action_date falls within the month, and a person can own multiple userids.

Data ModelingProduct Analytics & Metrics
Author's notes

This part looked manageable until I remembered the edge cases they listed out loud: userids in notifications that have no match in dim_circle_people should be excluded from person-level counts, and some accounts were created mid-August so you still count them.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, identify active accounts by filtering the notifications table for last_action_date within August 2025. Then, join to dim_circle_people to map userids to persons, aggregate the count of distinct active accounts per person, and finally bucket persons by account count (exactly 2, exactly 3, >3) and count distinct persons in each bucket, returning a single row with three columns.

Pro tip: Clarify whether 'active accounts' should be counted based on the notifications table alone or if other activity sources exist; also confirm that 'person' is the unique identifier in dim_circle_people and that userids are unique to a person.

1. Filter active accounts

Select distinct userids from the notifications table where last_action_date is between '2025-08-01' and '2025-08-31' (inclusive). This gives the set of active accounts for the month.

2. Map accounts to persons

Join the active accounts to dim_circle_people on userid to associate each active account with its owning person. Ensure the join is correct and handle any potential duplicates.

3. Count active accounts per person

Group by person and count the number of distinct active userids. This yields the number of active accounts each person had during August 2025.

4. Bucket persons by account count

Use conditional aggregation (e.g., CASE WHEN) to categorize each person into 'exactly 2', 'exactly 3', or 'more than 3' based on their active account count.

5. Count distinct persons per bucket

Count the number of distinct persons in each bucket and return a single row with three columns: count_exactly_2, count_exactly_3, count_more_than_3.

Key Points to Mention

  • Use of DISTINCT to count unique active accounts per person, avoiding double-counting if a userid appears multiple times in notifications.
  • Correct date filtering: last_action_date >= '2025-08-01' AND last_action_date < '2025-09-01' to include the entire month without timezone issues.
  • Join between notifications and dim_circle_people on userid, ensuring that the person identifier is correctly used for grouping.
  • Conditional aggregation with CASE statements or FILTER clause to create the three buckets in a single query.
  • Handling of persons with zero active accounts: they should be excluded from all buckets.
  • Efficiency considerations: filter before joining to reduce data volume, and use appropriate indexes if available.

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

Q2

Among persons with at least 2 active accounts in August 2025, what percentage had at least one unread notification across any of their accounts that month? Return the numerator, denominator, and the percentage rounded to two decimal places. A person should be counted only once even if multiple accounts had unread notifications, and persons with zero notifications belong in the denominator but not the numerator.

Data ModelingProduct Analytics & MetricsRoot Cause Analysis
Author's notes

This is where I fumbled a bit.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, identify the denominator by counting distinct persons who had at least two active accounts in August 2025. Then, for each person, check if any of their accounts had at least one unread notification during that month, and count those persons as the numerator. Finally, compute the percentage as (numerator / denominator) * 100, rounded to two decimal places.

Pro tip: Clarify the definitions of 'active account' and 'unread notification' upfront, as these can vary by product context; also consider edge cases like persons with multiple accounts where only one has unread notifications, ensuring deduplication at the person level.

1. Define metrics and time frame

Clearly define what constitutes an 'active account' (e.g., logged in, performed an action) and an 'unread notification' (e.g., notification delivered but not opened) for August 2025. Specify the time frame as the entire month.

2. Identify denominator population

From the accounts table, filter for accounts active in August 2025, then group by person to count distinct persons with at least two such accounts. This gives the denominator.

3. Identify numerator population

From the notifications table, filter for unread notifications in August 2025, join with accounts to get person IDs, and deduplicate to count distinct persons who had at least one unread notification across any account. Ensure these persons are also in the denominator.

4. Compute percentage

Divide the numerator by the denominator and multiply by 100 to get the percentage. Round the result to two decimal places.

5. Validate and sanity-check

Check for data quality issues (e.g., missing person IDs, duplicate accounts) and ensure the numerator is a subset of the denominator. Perform a quick sanity check on the percentage (e.g., it should be between 0 and 100).

Key Points to Mention

  • Deduplication at the person level to avoid double-counting individuals with multiple accounts.
  • Precise definition of 'active account' and 'unread notification' aligned with business context.
  • Time frame constraint: August 2025 only.
  • Handling of persons with zero notifications: they are in the denominator but not the numerator.
  • Use of SQL or equivalent for efficient joins and aggregations.
  • Rounding to two decimal places and reporting numerator, denominator, and percentage.

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