The Complete FAANG SQL Interview Guide (2026)
SQL interviews at Meta, Google, Amazon, Apple, and Netflix follow recognisable patterns. This guide covers every topic you need, what each company favours, and a 30-day plan to go from rusty to ready.
1. How SQL is tested at FAANG
SQL interviews at large tech companies take one of three forms:
Online assessment (OA)
A timed take-home screen — 60–90 minutes with 2–4 SQL problems. Common at Amazon for data analyst and business analyst roles. Speed and accuracy both matter. There is no partial credit.
Live technical screen
A 45–60 minute call where you write SQL in a shared editor (CoderPad, HackerRank) while thinking aloud. Common at Meta and Google. The interviewer cares as much about your reasoning as your final answer.
Onsite SQL round
One or two dedicated SQL sessions during a full-day onsite. Questions are harder — you may be asked to optimise a query, propose an index, or explain a query plan. Common for senior data engineer and data scientist roles.
Key insight: In live interviews, talking through your approach earns points even when your syntax isn't perfect. Practice writing SQL while narrating your thinking.
2. The 6 core SQL topics
Across all FAANG companies, six topics account for the vast majority of interview questions.
1. Window functions
The single most-tested advanced SQL concept — appearing in roughly 70% of hard interview questions.
ROW_NUMBER(),RANK(),DENSE_RANK()— ranking within groupsLAG(col, n),LEAD(col, n)— comparing to previous/future rowsSUM() OVER,AVG() OVER— running totals and moving averagesPARTITION BY— defining the group each function operates within- Frame clauses:
ROWS BETWEEN ... AND ...
2. JOINs
You need to be completely fluent with all join types. Interviewers use joins to test whether you understand the data model, not just the syntax.
- INNER JOIN — rows that match in both tables
- LEFT JOIN — all rows from left, NULLs where right doesn't match
- FULL OUTER JOIN — all rows from both tables
- SELF JOIN — joining a table to itself (friend graphs, hierarchies)
- Anti-join —
LEFT JOIN ... WHERE right.id IS NULL
3. Aggregation and GROUP BY
COUNT(*)vsCOUNT(col)— the NULL difference mattersCOUNT(DISTINCT col)— for unique user countsSUM(CASE WHEN ... THEN 1 ELSE 0 END)— conditional countsHAVINGvsWHERE— filtering after vs before aggregation
4. Common Table Expressions (CTEs)
CTEs make complex queries readable and maintainable. At FAANG, writing a deeply nested subquery is a red flag — experienced candidates use CTEs to break problems into logical steps.
WITH
monthly_active AS (
SELECT user_id, DATE_TRUNC('month', event_date) AS month
FROM events
GROUP BY 1, 2
),
user_months AS (
SELECT user_id, COUNT(DISTINCT month) AS active_months
FROM monthly_active
GROUP BY 1
)
SELECT active_months, COUNT(*) AS user_count
FROM user_months
GROUP BY 1 ORDER BY 1;
5. Subqueries
- Correlated subquery — references a column from the outer query
- Scalar subquery — returns exactly one value
- EXISTS / NOT EXISTS — efficient for existence checks
- IN / NOT IN — watch NULL behaviour with
NOT IN
6. Date and time manipulation
DATE_TRUNC('month', date)— truncate to time boundariesDATEDIFF(end, start)— days between two datesDATE_ADD(date, INTERVAL n DAY)— add time intervalsEXTRACT(YEAR FROM date)— pull out year, month, day, hour
3. SQL patterns by company
| Company | Data domain | Key topics |
|---|---|---|
| Meta | Social graphs, ads, user behaviour | Retention, DAU/MAU, window functions, self-joins |
| Search, ads, product analytics | Ranking, median, YoY growth, conditional aggregation | |
| Amazon | E-commerce, logistics, marketplace | Top-N per group, customer segmentation, anti-joins |
| Apple | Devices, subscriptions, content | Cohort analysis, subscription funnels, aggregate windows |
| Netflix | Streaming, content, engagement | Watch time, binge patterns, content performance |
4. 30-day study plan
Assuming 1–2 hours per day.
Week 1 — Foundation
- Days 1–2: JOINs — all types, especially LEFT JOIN and self-join
- Days 3–4: GROUP BY, HAVING, and aggregate functions
- Days 5–6: Subqueries — correlated, scalar, EXISTS
- Day 7: Review + 3 mixed easy challenges
Week 2 — Window functions
- Days 8–9: ROW_NUMBER, RANK, DENSE_RANK
- Days 10–11: LAG and LEAD — period comparisons
- Days 12–13: SUM/AVG OVER — running totals and moving averages
- Day 14: Review + 3 window function challenges at medium difficulty
Week 3 — Advanced patterns
- Days 15–16: Date functions — retention, cohort, streak queries
- Days 17–18: CTEs — refactor complex queries with WITH
- Days 19–20: Gaps and islands, consecutive day problems
- Day 21: Review + 3 hard challenges
Week 4 — Company-specific practice
- Days 22–23: Target company patterns (use the company pages above)
- Days 24–25: Timed practice — 30 min per question, no hints
- Days 26–27: Review weak spots from timed sessions
- Days 28–30: Full mock — 3 questions, 90 minutes, explain aloud
5. Interview day tips
Start with clarifying questions
Before writing anything, ask: Do we count NULL values? Should ties use RANK or DENSE_RANK? Is this PostgreSQL or BigQuery? These questions signal experience and prevent you from building the wrong solution.
Break the problem into steps, then combine
Never try to write a complex query in one pass. Narrate: "First I'll get the monthly aggregates, then join to find users who appear in consecutive months." Write each step as a CTE, then combine them.
Test with edge cases before declaring done
After writing your query, mention edge cases: "What if a user has no orders? This LEFT JOIN handles that — they'd appear with NULL on the right side."
Clean syntax signals experience
Use consistent indentation, uppercase keywords, and meaningful aliases. e.name, d.dept_name is clearer than a.name, b.name. Small things matter in live interviews.
Ready to practice?
SQL Quest covers every topic in this guide with 200+ hands-on challenges, real datasets, and AI tutoring. Free to start.
Start Practicing on SQL Quest →