Skip to content
The learning path

Learn SQL

Work top to bottom, or jump to a track. Each lesson pairs a short explanation with exercises you run right here in the browser, with hints and solutions when you get stuck. It is free with no account: your progress is saved in this browser.

Progress
0 of 127 lessons completed · 0 started
0% complete across 22 chapters, 5 tracks.
Start Chapter 1

Foundations

Start here: the essentials, in order. 0/24

Enter here if you have never written a query.

Joins & Logic

Combine tables and shape your output. 0/16

Enter here if SELECT, WHERE, and GROUP BY feel comfortable and joins do not.

Change & Debug

Edit data safely, then fix what breaks. 0/14

Enter here before you run an UPDATE on anything that matters.

Analytics & Applied Practice

Subqueries, then real reporting questions on fresh datasets. 0/32

Enter here if you write SQL at work and want reports: rates, cohorts, windows, CTEs.

10 0/9

Subqueries and EXISTS

Nested SELECTs · IN · EXISTS · NOT IN traps · ANY and ALL · latest row per group

Lessons
0 of 9 lessons completed
Start Chapter 10 →
  1. 10.1 Scalar subqueries New
  2. 10.2 IN with subqueries New
  3. 10.3 EXISTS and NOT EXISTS New
  4. 10.4 Correlated subqueries vs joins New
  5. 10.5 NOT IN vs NOT EXISTS New
  6. 10.6 ANY and ALL New
  7. 10.7 Subqueries in SELECT and HAVING New
  8. 10.8 IN vs JOIN with duplicates New
  9. 10.9 Latest row per group New
11 0/7

Practical Analytics Patterns

Top-N · rates · cohorts · windows · CTEs · QUALIFY · recursive CTEs

Lessons
0 of 7 lessons completed
Start Chapter 11 →
  1. 11.1 Top-N reports New
  2. 11.2 Percentages and rates New
  3. 11.3 Cohorts and time buckets New
  4. 11.4 Window functions New
  5. 11.5 Common table expressions New
  6. 11.6 Filtering windows with QUALIFY New
  7. 11.7 Recursive CTEs New
12 0/6

Applied Practice: Movie Rentals

Reapply joins · aggregates · dates · nulls on a fresh dataset

Lessons
0 of 6 lessons completed
Start Chapter 12 →
  1. 12.1 Browse the catalog New
  2. 12.2 Group the collection New
  3. 12.3 Rental revenue New
  4. 12.4 Who rented what New
  5. 12.5 Late and overdue rentals New
  6. 12.6 Top titles report New
13 0/6

Applied Practice: Website Analytics

Funnels · attribution · conversion rates on a marketing dataset

Lessons
0 of 6 lessons completed
Start Chapter 13 →
  1. 13.1 Sessions by channel New
  2. 13.2 Longest sessions New
  3. 13.3 Campaign attribution New
  4. 13.4 Anonymous sessions New
  5. 13.5 Conversion stage reach New
  6. 13.6 Top pages New
14 0/4

Applied Practice: Store Operations

Revenue · inventory · customer value · supplier margin

Lessons
0 of 4 lessons completed
Start Chapter 14 →
  1. 14.1 Daily revenue report New
  2. 14.2 Inventory reorder list New
  3. 14.3 Customer lifetime revenue New
  4. 14.4 Supplier margin report New

Advanced

Sets, pivots, missions, modeling, windows, statistics, time series, and nested data. 0/41

Enter here if you know SQL from PostgreSQL or MySQL and want the harder half, plus what DuckDB does differently.

15 0/4

Set Operations

UNION ALL · UNION · INTERSECT · EXCEPT

Lessons
0 of 4 lessons completed
Start Chapter 15 →
  1. 15.1 UNION ALL New
  2. 15.2 UNION New
  3. 15.3 INTERSECT New
  4. 15.4 EXCEPT New
16 0/6

Summary Reports and Pivots

Conditional aggregation · ROLLUP · STRING_AGG · CASE buckets · GROUPING SETS · PIVOT

Lessons
0 of 6 lessons completed
Start Chapter 16 →
  1. 16.1 Pivoting with conditional aggregation New
  2. 16.2 Subtotals with ROLLUP New
  3. 16.3 Listing values with STRING_AGG New
  4. 16.4 Distribution with CASE buckets New
  5. 16.5 GROUPING SETS and CUBE New
  6. 16.6 PIVOT and UNPIVOT New
17 0/8

Guided Playground Missions

Dataset scouting · revenue audits · scorecards · conversion reports

Lessons
0 of 8 lessons completed
Start Chapter 17 →
  1. 17.1 Map a dataset before querying New
  2. 17.2 Revenue audit mission New
  3. 17.3 Movie genre scorecard New
  4. 17.4 Channel conversion report New
  5. 17.5 Retention cohort report New
  6. 17.6 Pageview deduplication audit New
  7. 17.7 Campaign revenue report New
  8. 17.8 Rolling sessions report New
18 0/5

Modeling and Data Quality

Profiling · quality checks · semantic views · staging · rerunnable scripts

Lessons
0 of 5 lessons completed
Start Chapter 18 →
  1. 18.1 Profile a table before you query New
  2. 18.2 Check data quality with SQL New
  3. 18.3 Build a semantic view New
  4. 18.4 Stage, clean, and model New
  5. 18.5 Write a rerunnable script New
19 0/7

Window Functions in Depth

Ranking ties · LAG and LEAD · running totals · frames · share of total · top N per group · landing pages

Lessons
0 of 7 lessons completed
Start Chapter 19 →
  1. 19.1 Ranking and ties New
  2. 19.2 LAG and LEAD New
  3. 19.3 Running totals New
  4. 19.4 Window frames New
  5. 19.5 Share of total New
  6. 19.6 Top N per group New
  7. 19.7 Landing page conversion New
20 0/4

Statistics and Distributions

Medians and percentiles · standard deviation · mode · histograms

Lessons
0 of 4 lessons completed
Start Chapter 20 →
  1. 20.1 Medians and percentiles New
  2. 20.2 Standard deviation New
  3. 20.3 The most common value New
  4. 20.4 Building a histogram New
21 0/3

Time Series in SQL

Period over period · date spines · rolling calendar windows

Lessons
0 of 3 lessons completed
Start Chapter 21 →
  1. 21.1 Period over period New
  2. 21.2 Date spines New
  3. 21.3 Rolling calendar windows New
22 0/4

Lists, Structs, and JSON

list() · unnest · structs · JSON paths · -> and ->>

Lessons
0 of 4 lessons completed
Start Chapter 22 →
  1. 22.1 Lists New
  2. 22.2 Unnesting lists into rows New
  3. 22.3 Structs New
  4. 22.4 Querying JSON New

All 22 chapters are live, grouped into 5 tracks: Foundations, Joins & Logic, Change & Debug, Analytics & Applied Practice, and Advanced. Work through a track in order, or jump straight to the one you need.

What this workshop is, and is not

SQLShed teaches the SQL you write to answer questions: selecting, joining, grouping, windows, building tables, and changing data safely, in DuckDB's dialect with the portable form shown alongside. It doesn't cover running a database: indexes, query plans, permissions, or protecting an application from SQL injection. Those depend on the engine you deploy, though the reference explains indexes and query plans.

When you finish, take one of the practice datasets into PostgreSQL or SQLite and rebuild a report there.