57 challenges whose reference solution uses a subquery — a SELECT in parentheses that is not a CTE — counted from the live bank: 8 Easy, 32 Medium, 17 Hard. Cards marked Free (including the 2 Hard previews) are open to free accounts — your first 10 challenge solves are free — and Pro opens every card. If the shape is new, take the on-ramp in order: A Subquery That Returns One Value, A Subquery That Returns a Set (IN), then Filter on an Average You Just Computed, which is a whole query sitting in the FROM clause. After that the Medium ladder is wide. Real datasets, AI tutoring.
Start Practicing Free →Prefer to name the step instead of nesting it? CTE vs subquery vs temp table settles when the choice matters, and the CTE challenges are the WITH-clause side of the same bank.
WHERE salary > (SELECT AVG(salary) FROM employees) — the inner query runs once and returns one value; WHERE customer_id IN (SELECT …) returns a list to match against. The Easy on-ramps are here: A Subquery That Returns One Value, then the same shape on a second schema in Movies Rated Above the Average; then A Subquery That Returns a Set (IN), and Every Film by a Director Who Once Hit 8.5, where the list comes out of the table you are already selecting from. The Medium ones move the scalar into the SELECT list, into HAVING, inside COALESCE; the Hard ones nest it inside a CTE or divide by it for a share. Mind NOT IN against a nullable column — the NOT IN trap.
Counted from the challenge bank, September 2026. Easy first, then Medium, then Hard.
Uses: GROUP BY Aggregation Subquery HAVING
Uses: DELETE DML Subquery Aggregation
Finance & Banking track · Uses: WHERE Subquery
Finance & Banking track · Uses: Subquery JOIN ORDER BY
Uses: LEFT JOIN IS NULL CTE
Uses: Correlated Subquery COUNT WHERE
Finance & Banking track · Uses: Window Functions LAG JOIN
Finance & Banking track · Uses: CTE Aggregation Subquery Statistics
Aggregate first, then query the result — FROM (SELECT department, AVG(salary) AS avg_salary FROM employees GROUP BY department) d. Start with Filter on an Average You Just Computed, the Easy one — a country average computed in FROM and then filtered with a plain WHERE — then Subquery in FROM (Derived Table) and Above-Average Departments. The Hard ones wrap a window function you cannot filter in the same SELECT — ROW_NUMBER, LAG, a running SUM — and Running Total Revenue and Year-over-Year Growth are the 2 Hard previews. Three sector ones wrap a UNION ALL. A derived table is the case where a CTE reads better; the CTE tutorial shows the rewrite.
Counted from the challenge bank, September 2026. Easy first, then Medium, then Hard — previews before Pro.
Uses: Subquery Derived Table Aggregation GROUP BY
Uses: Subquery JOIN Aggregation GROUP BY
Uses: GROUP BY GROUP_CONCAT Aggregation Subquery
Uses: GROUP BY Aggregation Subquery HAVING
Uses: GROUP BY Aggregation Window Functions LAG
Finance & Banking track · Uses: UNION ALL WHERE Set Operations
Real Estate track · Uses: UNION ALL Set Operations
Manufacturing & Industry track · Uses: JOIN UNION ALL Set Operations
Uses: Subquery Window Functions GROUP BY Aggregation
Uses: Subquery Window Functions GROUP BY Aggregation
Uses: Subquery Window Functions WHERE Window Function
The subquery is the inside-out spelling; the same problems written top-down with WITH are on the CTE page, and several Hard ones here open with WITH and appear on both. When the choice matters — and when it does not — is on CTE vs subquery vs temp table.