Practice

SQL Practice

Every exercise, quiz, and project in one place. Work through a part's exercises after reading it, and come back here to revise.

SQL workbench — write and run queries here

Press Run and PostgreSQL loads right in your browser (a one-time download of about 16 MB; after that it works offline). It comes seeded with shopdb, and statements share one session per page — like a psql window. Reset data rebuilds shopdb. Your queries never leave this page. Lessons were captured on PostgreSQL 17; the in-browser server is PostgreSQL 19 (via PGlite), so the rare output detail can differ.

Exercises by part

Part 01 · 6 exercises · 8 quick quizzesGetting startedPart 02 · 8 exercises · 9 quick quizzesReading dataPart 03 · 7 exercises · 9 quick quizzesTypes, NULL and functionsPart 04 · 7 exercises · 6 quick quizzesSummarising dataPart 05 · 8 exercises · 9 quick quizzesJoining tablesPart 06 · 8 exercises · 8 quick quizzesSubqueries, CTEs and set operationsPart 07 · 8 exercises · 8 quick quizzesWindow functionsPart 08 · 8 exercises · 10 quick quizzesAnalytics patternsPart 09 · 4 exercises · 7 quick quizzesData modelingPart 10 · 6 exercises · 9 quick quizzesBuilding schemas (DDL)Part 11 · 7 exercises · 7 quick quizzesChanging data (DML)Part 12 · 6 exercises · 9 quick quizzesTransactions and concurrencyPart 13 · 6 exercises · 8 quick quizzesReusable logicPart 14 · 6 exercises · 10 quick quizzesSemi-structured data and searchPart 15 · 5 exercises · 7 quick quizzesHow PostgreSQL works insidePart 16 · 4 exercises · 5 quick quizzesReading query plansPart 17 · 5 exercises · 8 quick quizzesIndexingPart 18 · 5 exercises · 7 quick quizzesQuery tuning

Projects

After Part 4The store sales reportAfter Part 8The customer analytics packAfter Part 14The booking systemAfter Part 18Tune It

Search the guide