SQL Practice by Topic — GROUP BY, Window Functions, Joins, CTEs, CASE WHEN, Subqueries, Dates

Seven topic sets, all drawn from the same bank. Each page lists the challenges it actually contains — every card is a real challenge with a working deep link, not a category tile — and states its difficulty split, so you can see before you click whether a topic has a gentle way in or drops you straight into Hard.

Every number below is counted from the live bank, which is why the shapes differ: joins and CASE WHEN are mostly free and mostly Medium, window functions are Hard-heavy, and the CTE set has one Easy rung. Aggregation is the outlier in the other direction — more than half the bank touches it, so that page lists a chosen subset and tells you which. That is the bank as it stands, not a marketing round-up.

Start Practicing Free →

Counted from the challenge bank, September 2026.

GROUP BY & aggregation

156 challenges · 116 free · 31 Easy

COUNT and SUM over a whole table, GROUP BY on one key or on several, HAVING to filter the groups, and COUNT(DISTINCT …) against COUNT(*). More than half the bank touches this, so its page lists a chosen subset in five complete sections and says so.

GROUP BY challenges →

Window functions

64 challenges · 23 free · 3 Easy

ROW_NUMBER, RANK and DENSE_RANK, LAG and LEAD, running totals and frame clauses. The deepest set on the site and the steepest: three Easy rungs, then a long Hard bank. Start at AVG(x) OVER () and do not skip the on-ramp.

Window function challenges →

Joins

87 challenges · 58 free · 8 Easy

INNER and LEFT, anti-joins, self-joins, multi-table joins at the right grain. The widest free set here, with sections for the two that interviews actually turn on: LEFT JOIN and the self-join.

JOIN challenges →

CTEs (WITH clauses)

62 challenges · 26 free · 1 Easy

Every challenge whose reference solution reaches for WITH — including the chains where a later CTE reads an earlier one, and the recursive ones that walk a hierarchy. One Easy rung, then Medium.

CTE challenges →

CASE WHEN

51 challenges · 40 free · 8 Easy

Row labels, bucketing before a GROUP BY, and the conditional aggregation that pivots a table — SUM(CASE WHEN … THEN 1 ELSE 0 END). The friendliest set to start on: almost all of it is free.

CASE WHEN challenges →

Subqueries

57 challenges · 42 free · 8 Easy

A SELECT in parentheses that is not a CTE: scalar and IN subqueries in WHERE, correlated subqueries and EXISTS, derived tables in FROM. The Easy on-ramp was written for this page.

Subquery challenges →

String functions

14 challenges · 13 free · 7 Easy

Pull a piece out with SUBSTR and INSTR, rewrite a messy value with TRIM and REPLACE, and match a shape with LIKE. The cleaning step that makes the real question askable.

String challenges →

NULL handling

20 challenges · 18 free · 6 Easy

Why = NULL never matches, COALESCE for a default that belongs there, and the aggregates that skip NULLs while COUNT(*) does not. The best free coverage of any topic here.

NULL challenges →

Date functions

37 challenges · 27 free · 6 Easy

strftime for the month or weekday you group by, julianday for a span in days, and the half-open date window that does not drop its last day. SQLite has no DATE_TRUNC and no INTERVAL, which is the useful case to learn.

Date function challenges →

Ranking functions

32 challenges · 10 free · 1 Easy

ROW_NUMBER, RANK and DENSE_RANK on their own page: one row per group, ties handled on purpose, and the top-N-per-group query that most ranking questions turn out to be.

Ranking function challenges →

Advanced SQL interview questions

79 challenges · 6 free · 0 Easy

Every Hard challenge in the bank, sorted into Hard window questions, multi-step CTEs, and multi-table joins with subqueries. The free previews come first.

Advanced questions →

Or browse every SQL interview question, one page each →

Missing a topic? NULL handling and string functions have no page of their own yet — they are in the bank, reachable by difficulty, company or industry from the full exercise hub, which is also where the sector tracks on real public data live.