← Interview Preparation

SQL Interview Roadmap

SQL query-writing for coding interviews — filtering, joins, aggregation, subqueries, CTEs, and window functions, plus just enough keys/ACID/indexing theory to answer the conceptual questions that come up alongside them.

Time budget: ≈15h

How to use this roadmap

  • This is a SQL coding interview roadmap, not a system design or database design one — there's no schema design, no storage-engine internals, and no B-tree implementation details. Just query-writing fluency and the theory that supports it.
  • Go through topics top to bottom — Window Functions and Recursive CTEs assume the join, aggregation, and subquery fluency built up in the earlier topics.
  • Most problems are free LeetCode Database questions; a handful of premium LeetCode problems and one PostgreSQL Exercises problem are marked accordingly where they teach something the free set doesn't.
  • This is an independent track in the interview prep collection: its own progress, its own “come back later” list, and no interview countdown.

Your Progress

0%
0 / 33Problems solved
0h / 15hTime invested
13Subtopics across 6 topics
Solved by difficulty
0/71
0/132
0/93
0/44
0/05
Progress by topic
SQL Query Fundamentals
0/10
Joins & Multi-Table Queries
0/9
Aggregation & Grouping
0/9
Subqueries & CTEs
0/7
Window Functions
0/8
SQL & Database Theory Essentials
0/3

Next Problem

Loading…

0Come Back Later

The Roadmap

  1. 1

    The query skeleton you'll type in some form in almost every other subtopic on this roadmap — and the NULL-comparison trap that catches candidates who've never had it explained properly.

    1. 1.1Filtering & Sorting Basics!!!1/51h 2m
    2. 1.2String & Date Functions, CASE Expressions!!2/51h 22m
  2. 2

    Almost no interesting business question lives in a single table — this is where SQL interviews actually start.

    1. 2.1Join Types: INNER, LEFT/RIGHT, FULL, Self-Joins!!!2/51h 20m
    2. 2.2Set Operations & Anti-Joins!!3/51h 10m
  3. 3

    Turning many rows into one summary row per group — the mechanism behind almost every "count/sum/average X per Y" interview question.

    1. 3.1GROUP BY, HAVING & Aggregate Functions!!!2/51h 27m
    2. 3.2Advanced Aggregation & Pivoting!!3/51h 25m
  4. 4

    Answering a question about a group's own aggregate — "who's above average," "who's the top earner per department" — needs a query nested inside a query, one way or another.

    1. 4.1Correlated Subqueries & EXISTS!!3/51h 40m
    2. 4.2CTEs & Recursive Queries!!4/51h 20m
  5. 5

    The single highest-leverage topic in this roadmap for a senior-level SQL interview: compute a rank, a running total, or a per-group comparison without collapsing the rows that produced it.

    1. 5.1Ranking Functions: ROW_NUMBER, RANK, DENSE_RANK!!!3/51h 40m
    2. 5.2Running Totals, Moving Averages & Frame Clauses!!4/51h 39m
  6. 6

    The handful of verbal, conceptual questions a database-focused interview loop tends to mix in alongside the query-writing — kept deliberately shallow, since this roadmap is about passing a coding interview, not a systems design one.

    1. 6.1Keys & Normalization Basics!!2/520m
    2. 6.2Transactions, ACID & Isolation Levels!!3/525m
    3. 6.3Indexing & Query Performance Basics!!2/520m