SQL Study Plan
Study in short sessions that end with a query you can explain. Use the shop dataset first, then add a few rows of your own. Small deliberate changes reveal more than repeatedly running an unchanged example.
Understand the idea
Session 1: list, filter, and sort products. Session 2: compare missing values and aggregates. Session 3: join customers and orders, including zero matches. Session 4: create a constrained table and test an invalid row. Session 5: use a transaction and rollback. Session 6: write a window report and inspect a plan. Return to any step where you cannot predict a result.
Where to try it
Run this example in the SQL playground. The lesson link loads the shop tables and sample rows before this query. Select Run when you are ready. Every run starts fresh, so your changes do not affect the website or a previous run.
SQLite sample data · MySQL / MariaDB sample data · See the sample tables
Your task
Use this report as a checkpoint: add a product, predict its effect on one group, run the changed script, and explain every changed value.
Show the worked solution
SELECT category, COUNT(*) AS listings, SUM(stock) AS units
FROM products
GROUP BY category
ORDER BY category;
Check your result
Accessories has 1 listing and 0 units, Home has 1 and 8, and Stationery has 2 and 65. This compact report revisits grouping, counts, totals, aliases, and ordering together.