SQL from Zero: Answer a Bookshop's Questions from Its Database
<p>Hartley & Page Books is an independent bookshop in Portland that also sells online, and every online order sits in a database nobody at the shop has ever opened. The developer who built it has moved on, and Nisha Menon, three weeks into the job, has been handed the database and a year's worth of questions from the owner, Ruth Hartley. Which books are under $10? How many paid orders came in last year? Which titles earn the most, which never sold, who are the regulars, and which genres deserve more shelf space?</p><p>Across five lessons you answer those questions with SQL you write yourself, in an SQL lab that runs in your browser on the shop's MySQL database: SELECT, WHERE and ORDER BY, GROUP BY and HAVING, dates stored as text, inner and left joins, COUNT(DISTINCT), averages and NULLs, monthly totals, subqueries, WITH, and ranking with a window function. Every lesson then hands the same job to your AI (ChatGPT, Claude, Gemini or Copilot) and shows you exactly how to catch its mistakes: the whole-number division, the missing status filter, the dropped 31 December, the join that counts the wrong thing. In the capstone your AI drafts the whole genre review from one brief, and you prove every row. Bartman runs your queries on the same read-only database and checks the results.</p>
Tools: SQL, MySQL, SELECT, WHERE and ORDER BY, GROUP BY and HAVING, JOINs (INNER and LEFT), Window Functions (RANK), AI Assistants for SQL