SQL Practice Questions and Exercises (2026)

One candidate lost an onsite at a payments company because their JOIN fan-out turned a 40-row expected result into 12,000 duplicated rows and they couldn't explain why in under two minutes. That's what these exercises train for. Real schemas, real tables, real failure modes. You write the query, the grader runs it against Postgres, and you see exactly what your logic produced.

SQL practice FAQ

How many SQL practice questions before interviewing?+
80-120 exercises across categories. After ~80 problems most people have seen every common pattern at least twice. You want pattern recognition, not memorization. If you can solve a medium problem in under 15 minutes without hints, you're ready for most interviews.
Which SQL dialect should I practice in?+
PostgreSQL. Most interview platforms run Postgres or something close. Syntax differences between PG, MySQL, and BigQuery are small for interview-level questions — window functions, CTEs, and JOIN syntax are identical. The differences (STRING_AGG vs GROUP_CONCAT, date function names) rarely matter.
What's the most important SQL topic for DE interviews?+
Aggregation with GROUP BY (~1 in 4 questions). Then JOINs (especially LEFT JOIN and anti-join patterns), window functions (ROW_NUMBER, RANK, LAG/LEAD), and CTEs. Fluency in these four covers the vast majority of interview problems.
How do I get faster at solving SQL problems?+
Pattern recognition + muscle memory. Pattern recognition: see a problem, immediately know which constructs to reach for. Muscle memory: syntax flows without thinking. Both require volume. 10-15 timed exercises per week with mistake review — speed follows within 3-4 weeks.
02 / Why practice

Break queries. Fix queries. Ship.

  1. 01

    Active recall beats re-reading by 50%

    Cognitive-science meta-reviews (Dunlosky et al., 2013) rank practice testing as a top-tier study technique, while re-reading and highlighting rank near the bottom

  2. 02

    76% of hiring managers reject on the coding task, not the resume

    From HackerRank's 2024 Developer Skills Report. Candidates who look strong on paper still fail the live screen if they haven't done timed, executable practice

  3. 03

    Five problem shapes cover 80% of data engineer loops

    Dedup, sessionization, top-N-per-group, slowly-changing dimensions, partition tricks. Writing the shapes by hand turns the unfamiliar into pattern recognition

Related guides