← Meta Interview Insights

Meta·Data Scientist·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

SQL round at Meta for a DS role, two questions back to back. The schema was straightforward but the second question tripped me up more than I expected for something that looked like a simple percentage calculation.

Questions Asked (2)

Q1

Given a users-accounts-notifications schema, write a query that buckets users by how many accounts they have: exactly 2, exactly 3, or 4 or more. Return the bucket label and the count of users in each bucket.

Product Analytics & MetricsData Modeling
Author's notes

Went with a CTE to count accounts per user first, then a CASE in the outer query to assign buckets, then GROUP BY that.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the schema and defining the buckets using a CASE statement based on account counts per user. Then aggregate to count users in each bucket, ensuring all buckets are represented even if empty.

Pro tip: Use a LEFT JOIN from a derived table of buckets to ensure all buckets appear, and mention that this approach scales well for product analytics.

1. Clarify Schema and Requirements

Confirm the table structures and relationships, especially how users link to accounts. Verify that 'users-accounts-notifications' implies a one-to-many relationship between users and accounts.

2. Count Accounts per User

Write a subquery to count the number of accounts for each user, grouping by user ID. This gives a per-user account count.

3. Assign Buckets

Use a CASE statement to categorize each user into 'exactly 2', 'exactly 3', or '4 or more' based on their account count.

4. Aggregate and Count Users

Group by the bucket label and count the number of users in each bucket. Ensure all buckets are included, even if no users fall into them.

5. Validate and Optimize

Check for edge cases (e.g., users with 0 or 1 account) and consider performance implications, such as indexing on user_id in the accounts table.

Key Points to Mention

  • Use of CASE statement for bucketing
  • Subquery to count accounts per user
  • Handling of users with fewer than 2 accounts (excluded or separate bucket)
  • Ensuring all buckets appear in output (e.g., via LEFT JOIN with a bucket list)
  • Performance considerations: indexing, avoiding unnecessary joins
  • Interpretation of results for product analytics (e.g., user engagement)

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

Q2

Among users who have 2 or more accounts, what percentage have at least one unread notification across any of their accounts?

Product Analytics & MetricsData Modeling
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, clarify the metric definition and the data model, including how to identify users with 2+ accounts and how to handle unread notifications across accounts. Then, write a SQL query that joins users to their accounts and notifications, filters for users with 2+ accounts, and calculates the percentage of those users who have at least one unread notification in any account.

Pro tip: Explicitly state your assumptions about the data model (e.g., account-user relationship, notification read status) and mention edge cases like deactivated accounts or notifications marked as read but not seen. This shows you think like a product analyst who considers data quality and user experience.

1. Clarify the metric and data model

Define what '2 or more accounts' means (e.g., accounts linked to the same user) and how unread notifications are represented (e.g., a boolean flag or timestamp). Confirm the grain of the data and any necessary filters (e.g., active accounts only).

2. Identify users with 2+ accounts

Write a subquery to count the number of accounts per user and filter for users with a count >= 2. This creates the denominator population.

3. Determine which of these users have unread notifications

Join the filtered users to their accounts and then to notifications, filtering for unread notifications. Use a DISTINCT or EXISTS clause to flag users who have at least one unread notification across any account.

4. Calculate the percentage

Divide the number of users with 2+ accounts and at least one unread notification by the total number of users with 2+ accounts, then multiply by 100 to get the percentage.

5. Validate and consider edge cases

Check for data quality issues (e.g., nulls, duplicate accounts) and discuss how to handle edge cases like users with deactivated accounts or notifications that are unread but not delivered.

Key Points to Mention

  • Definition of 'user' and 'account' in the data model (e.g., one user can have multiple accounts).
  • How to identify unread notifications (e.g., read_at IS NULL or is_read = false).
  • Use of subqueries or CTEs to first filter users with 2+ accounts.
  • Use of DISTINCT or EXISTS to avoid double-counting users with multiple unread notifications.
  • Consideration of active vs. inactive accounts and whether to include them.
  • Potential need to handle time zones or notification expiration if relevant.

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