What SQL questions does Meta ask?
Meta's data interviews focus on user behaviour analysis — the kind of queries a data analyst runs against Meta's core products. Based on hundreds of interview reports, these are the most common patterns:
User Retention Analysis
Given a logins table with timestamps, calculate the Day-1 and Day-7 retention rate for a cohort of users who joined in January.
Uses: LAG() DATEDIFF COUNT(DISTINCT) self-join
DAU / MAU Ratio
Calculate the daily active users to monthly active users ratio for each day. Return days where the ratio fell below 0.1.
Uses: COUNT(DISTINCT) DATE_TRUNC window frames
Friend Recommendations
From a friendships table, find users who share at least 2 mutual friends but are not currently connected.
Uses: self-join NOT EXISTS HAVING COUNT
Consecutive Active Days
Find all users active for at least 3 consecutive days in Q1. Return user IDs and the start of their longest streak.
Uses: ROW_NUMBER() date arithmetic gaps-and-islands
Ad Click Funnel
Given impression and click event tables, calculate click-through rate by ad type and identify the lowest-performing categories.
Uses: LEFT JOIN COALESCE CTR calculation
Running Total of Posts
For each user, calculate a cumulative count of posts ordered by date. Return the user, post date, and running total.
Uses: SUM() OVER (PARTITION BY ... ORDER BY ...)