← Meta Interview Insights

Meta·Data Scientist·Technical Phone Screen·Senior

Senior
Jun 2026

Summary

SQL-heavy technical screen for a Data Scientist role at Meta. Four-part question built around two tables, covering unread notification rates, per-type breakdowns, multi-account person detection, and deduplication. Pretty demanding for a phone screen.

Questions Asked (4)

Q1

Given a notifications table and a people_users table, write SQL to find what percentage of users currently have at least one unread notification. Return the numerator, denominator, and percentage rounded to 2 decimal places. The denominator must include users with zero notifications.

Product Analytics & MetricsData Modeling
Author's notes

The denominator piece is where I almost tripped up.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by identifying the correct denominator: all users from the people_users table, including those with zero notifications. Then, determine which users have at least one unread notification by joining to the notifications table and filtering for unread status. Finally, compute the numerator, denominator, and percentage, rounding the percentage to two decimal places.

Pro tip: Always clarify the definition of 'unread' (e.g., a status column or a read_at timestamp) and confirm whether the denominator should include all users or only active users. Explicitly state your assumptions to avoid ambiguity.

1. Clarify table schemas and definitions

Identify the relevant columns: user ID in people_users, and user ID, notification status (e.g., is_read or read_at) in notifications. Confirm what 'unread' means and whether all users should be included in the denominator.

2. Compute the denominator

Count all users from the people_users table. This ensures users with zero notifications are included.

3. Compute the numerator

Count distinct users who have at least one unread notification. Use a subquery or join with a filter on unread status, and ensure each user is counted only once.

4. Calculate the percentage

Divide the numerator by the denominator, multiply by 100, and round to two decimal places. Return all three values.

Key Points to Mention

  • Use LEFT JOIN or a subquery to include users with zero notifications in the denominator.
  • Use COUNT(DISTINCT user_id) to avoid double-counting users with multiple unread notifications.
  • Filter for unread notifications correctly (e.g., WHERE is_read = false or read_at IS NULL).
  • Handle potential NULLs or missing data appropriately.
  • Round the percentage using ROUND(..., 2) and consider casting to decimal to avoid integer division.
  • Consider performance implications and indexing on user_id and read status.

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

Q2

Break down the unread notification percentage by notification_type. For each type, return the number of users with at least one unread of that type, the total user count, and the percentage. A user can appear in multiple types.

Product Analytics & MetricsData Modeling
Author's notes

I found this trickier than part (a) because you need a cross join or a similar expansion to correctly assign each user a row per type, then check for unread presence per type.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the schema and definitions: what constitutes an unread notification, how notification types are identified, and whether the user count is over all users or only those who received that notification type. Then outline a SQL query that joins notifications with users, filters for unread, and aggregates per notification type, computing distinct user counts and percentages relative to the total user base. Finally, discuss how to handle edge cases like users with no notifications or multiple unread notifications of the same type.

Pro tip: Always clarify whether the denominator should be all users or only users who received that notification type, as this drastically changes the percentage and is a common point of confusion in product analytics interviews.

1. Clarify definitions and requirements

Ask questions to confirm what 'unread' means (e.g., status = 'unread'), how notification types are defined, and whether the total user count is the entire user base or only users who received that type. Also confirm if a user can have multiple unread notifications of the same type and should be counted once.

2. Identify relevant tables and fields

Determine the tables needed: likely a notifications table with user_id, notification_type, and status; and a users table for the total user count. Ensure you know the join keys and any filters (e.g., date range, active users).

3. Write the aggregation query

Use a subquery or CTE to get distinct user counts per notification type for unread notifications. Then compute the percentage by dividing by the total user count (or the count of users who received that type, depending on clarification). Use LEFT JOIN or UNION to ensure all notification types are included even if no unread notifications exist.

4. Validate and interpret results

Check for anomalies: percentages over 100%, missing types, or unexpected counts. Discuss how to interpret the results in a product context, such as which notification types have high unread rates and potential reasons.

Key Points to Mention

  • Use COUNT(DISTINCT user_id) to avoid double-counting users with multiple unread notifications of the same type.
  • Clarify the denominator: total user base vs. users who received that notification type, as this affects the percentage interpretation.
  • Handle notification types with zero unread notifications by using a LEFT JOIN from a list of all types or a UNION.
  • Consider time windows (e.g., last 30 days) to make the metric actionable and avoid stale data.
  • Discuss potential data quality issues, such as null notification types or users not in the users table.
  • Mention how this metric could be used to prioritize product improvements or A/B tests.

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

Q3

What percentage of distinct persons have more than one associated user account? Also report what percentage of all user_ids belong to those multi-account persons.

Product Analytics & MetricsData Modeling
Author's notes

Two separate percentages in one question, which is easy to conflate.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the definitions of 'distinct persons' and 'associated user account', then compute the two percentages using SQL or equivalent by grouping user accounts by person. Ensure to handle edge cases like nulls and duplicates, and consider the time frame for the analysis.

Pro tip: Always state your assumptions about what constitutes a 'person' (e.g., email, phone, or a unique person ID) and how accounts are linked; this shows you understand data modeling nuances and prevents misinterpretation.

1. Clarify Definitions and Assumptions

Define what a 'distinct person' means (e.g., based on a person_id or a combination of identifiers) and what constitutes an 'associated user account'. State any assumptions about data completeness and linkage.

2. Identify the Relevant Tables and Fields

Locate the tables containing person identifiers and user account identifiers. Determine the join keys and any filters needed (e.g., active accounts, time period).

3. Compute the First Percentage

Calculate the percentage of distinct persons who have more than one user account. This involves grouping by person and counting accounts, then dividing the count of persons with >1 account by the total distinct persons.

4. Compute the Second Percentage

Calculate the percentage of all user_ids that belong to multi-account persons. This involves summing the number of accounts for persons with >1 account and dividing by the total number of user_ids.

5. Validate and Interpret Results

Check for data quality issues (e.g., duplicates, nulls) and validate the results. Interpret the percentages in the context of the business question, considering implications for user behavior or product metrics.

Key Points to Mention

  • Definition of 'distinct person' and how it is identified in the data (e.g., person_id, email, phone).
  • Handling of edge cases: null values, duplicate accounts, and accounts linked to multiple persons.
  • Use of SQL aggregation functions (COUNT DISTINCT, GROUP BY, HAVING) to compute the metrics.
  • Consideration of time frame: whether to include all accounts ever created or only active accounts in a specific period.
  • Interpretation of results: what high or low percentages indicate about user behavior and potential product implications.
  • Data quality checks: ensuring no double-counting and that the join between persons and accounts is correct.

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

Q4

How would you make your SQL queries robust to duplicate rows in the notifications table, where the same notification_id might be logged more than once? Briefly explain your deduplication assumption in a comment.

Data ModelingTechnical Trade-offs
Author's notes

I added a CTE at the top that does SELECT DISTINCT on notification_id, taking the MIN or MAX of the other columns, or alternatively used ROW_NUMBER() partitioned by notification_id to keep one row per id.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the deduplication assumption: whether duplicate rows are exact duplicates or represent multiple events, and which columns define uniqueness. Then propose SQL techniques like DISTINCT, ROW_NUMBER() with a window function, or GROUP BY to deduplicate, and explain how to embed the assumption in a comment for maintainability.

Pro tip: Mention that deduplication should happen as early as possible in the query pipeline to avoid skewing downstream aggregations, and always validate the assumption with a quick COUNT vs COUNT(DISTINCT) check before applying logic.

1. Clarify the deduplication assumption

Determine whether duplicates are exact copies or distinct events, and identify the key columns (e.g., notification_id) that define uniqueness. Document this assumption in a SQL comment.

2. Choose a deduplication strategy

Select an appropriate SQL method: DISTINCT for exact duplicates, ROW_NUMBER() for keeping the latest/earliest record, or GROUP BY for aggregating duplicates.

3. Implement deduplication in a subquery or CTE

Apply the chosen method in a subquery or CTE to create a clean dataset before joining or aggregating, ensuring duplicates don't affect results.

4. Validate and test

Run sanity checks like comparing row counts before and after deduplication, and test edge cases (e.g., all duplicates, no duplicates) to ensure robustness.

5. Explain trade-offs

Discuss performance implications (e.g., window functions vs. DISTINCT) and correctness trade-offs (e.g., losing event-level detail) to demonstrate technical maturity.

Key Points to Mention

  • Use of DISTINCT vs. ROW_NUMBER() vs. GROUP BY for deduplication
  • Importance of defining a unique key (e.g., notification_id) and handling ties
  • Embedding assumptions in SQL comments for clarity and maintainability
  • Performance considerations: window functions can be expensive on large tables
  • Impact on downstream aggregations and joins if duplicates are not removed
  • Validation techniques: COUNT vs. COUNT(DISTINCT), checking for unexpected duplicates

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