← Meta Interview Insights

Meta·Data Scientist·Technical Phone Screen·Senior

Senior
May 2026

Summary

Meta DS interview with a pretty involved SQL problem covering date arithmetic and user segmentation. Two-part question, more depth than I expected for a technical screen.

Questions Asked (2)

Q1

Given a users table with signup dates and an activity table with daily presence records, write SQL that labels each (user_id, activity_date) row as 'new' if the activity date falls within 30 days of signup (inclusive), and 'old' otherwise. The output should cover a specific date range and avoid multiple labels per user-day.

Data ModelingProduct Analytics & Metrics
Author's notes

Took me a minute to internalize that 'first 30 days inclusive' means signup_date + 29, not + 30.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the date range and the definition of 'new' (within 30 days of signup, inclusive). Then, write a query that joins the activity table with the users table, computes the date difference, and uses a CASE statement to label each row. Ensure that each user-day appears only once by aggregating or using DISTINCT if necessary.

Pro tip: In a real interview, mention that you would validate the date range with the stakeholder and consider edge cases like users who signed up before the range but were active during it. Also, discuss how you would handle time zones if the data spans multiple regions.

1. Clarify requirements

Confirm the specific date range for the output and the exact definition of 'new' (e.g., inclusive of the 30th day). Ask about any edge cases, such as users who signed up before the range.

2. Identify necessary tables and columns

Determine that you need the users table (user_id, signup_date) and the activity table (user_id, activity_date). Ensure you understand how to join them.

3. Compute date difference and label

Use a CASE statement to check if activity_date is between signup_date and signup_date + 30 days (inclusive). Label as 'new' if true, else 'old'.

4. Filter by date range and deduplicate

Apply a WHERE clause to restrict activity_date to the specified range. Use DISTINCT or GROUP BY to ensure each (user_id, activity_date) appears only once.

5. Write and explain the final SQL

Construct the full query, explaining each part. Optionally, discuss performance considerations like indexing on date columns.

Key Points to Mention

  • Use of DATE_DIFF or equivalent function to calculate days between signup and activity.
  • Inclusive boundary: activity_date <= signup_date + INTERVAL '30 days'.
  • Filtering activity_date to the specified range before or after labeling.
  • Ensuring uniqueness with DISTINCT or GROUP BY on (user_id, activity_date).
  • Handling users with no activity in the range (they won't appear, which is correct).
  • Potential need to consider time zones if dates are timestamps.

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

Q2

Using the labels from part one, compute two aggregates over a rolling 30-day window ending today: the count of active new vs old users per day, and a single summary row with total distinct users by label across the whole window. Also explain your assumptions about timezone handling and whether bounds are inclusive or exclusive.

Product Analytics & MetricsTechnical Trade-offs
Author's notes

The per-day breakdown was fine, just a GROUP BY on date and label after filtering the window.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the definitions of 'active', 'new vs old', and 'label' from part one, then write SQL or pseudocode that computes daily counts and a window-level distinct count. Explicitly state timezone and boundary assumptions, and validate with edge cases like users active on multiple days.

Pro tip: Mention that you would confirm with stakeholders whether 'new' means first-ever activity or first activity in the window, as this changes the metric significantly. Also, note that distinct counts in a rolling window cannot be summed from daily counts, so you need a separate aggregation.

1. Clarify definitions and assumptions

Restate the labels from part one (e.g., new vs old users) and define 'active' (e.g., any event). State timezone (e.g., UTC) and whether the 30-day window includes today and the start date.

2. Design the daily aggregation query

Write a query that groups by date and label, counting distinct active users per day. Use a date filter for the last 30 days including today.

3. Compute the summary distinct count

Write a separate query that counts distinct users by label across the entire 30-day window, ensuring no double-counting of users active on multiple days.

4. Handle timezone and boundary inclusivity

Specify how timestamps are converted to dates (e.g., UTC) and whether the window is [today-29 days, today] inclusive. Explain the impact of exclusive bounds.

5. Validate and explain trade-offs

Discuss potential pitfalls like users changing labels, late-arriving data, and performance considerations for large datasets. Suggest validation checks.

Key Points to Mention

  • Definition of 'new' vs 'old' user (e.g., first activity ever vs first in window)
  • Timezone handling (e.g., UTC vs local) and its effect on daily boundaries
  • Inclusive vs exclusive date bounds (e.g., [today-29, today] vs (today-30, today])
  • Distinct count aggregation cannot be summed from daily counts
  • Handling users who appear under multiple labels or change status
  • Performance considerations for large-scale data (e.g., partitioning, approximate distinct counts)

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