We use analytics and advertising cookies to understand how the site is used and whether our ads on Facebook and Instagram work. They are set only if you accept. See our Privacy Policy for details.
Aggregation collapses many rows into per-group summaries with GROUP BY and functions like COUNT, SUM, and AVG, filtered after grouping with HAVING. Interviewers reach for it constantly - "revenue per category", "departments with more than N employees" - because it exposes whether you understand the difference between filtering rows (WHERE) and filtering groups (HAVING). Expect it combined with joins in almost every medium-difficulty screen.
24 problems across 5 schemas · 4 free for registered users. Each runs your query in an isolated SQLite sandbox with instant, graded feedback.
A quick data question to warm up before you write SQL. No signup needed.
Product data arrives in three normalised source tables: product, subcategory and category. The reporting model needs a single product dimension, and a product's category history must be kept when it changes. How should the data be prepared?
Keep the syntax at your fingertips with the free SQL quick references, then come back and solve.