SQL interview topics
The patterns that come up again and again in data analyst and data scientist SQL screens.
Aggregation & GROUP BY
COUNT, SUM, AVG, GROUP BY and HAVING.
29 problems
Joins
Inner, left and anti-joins, plus fan-out traps.
21 problems
Conditional Aggregation
CASE inside SUM/AVG to pivot metrics.
6 problems
Window Functions
OVER, PARTITION BY, LAG/LEAD and frames.
21 problems
Ranking & Top-N per Group
ROW_NUMBER, RANK and DENSE_RANK.
5 problems
Running Totals & Rolling Windows
Cumulative sums, moving averages, Pareto cuts.
3 problems
Retention & Cohorts
Cohort tables, new vs returning users.
3 problems
Funnels & Activation
Ordered funnels and time-boxed conversion.
2 problems
Self-Joins
Joining a table to itself: referrals, pairs, transitions.
4 problems
Dates & Time
Truncation, date math and calendar buckets.
30 problems
Subqueries & CTEs
Step-by-step queries with WITH.
21 problems
Marketing Attribution
First-touch, last-touch, linear and ROAS.
3 problems
Gaps & Islands
Streaks and sessionization.
2 problems