This is an interactive book which aims to be the best place on the internet for learning SQL. It is free of charge, free of ads and doesn't require registration or downloads. It helps you learn by running queries against a real-world dataset to complete projects of consequence. It is not a mere reference page — it conveys a mental model for writing SQL.

I expect little to no coding knowledge. Each chapter is designed to take about 30 minutes. As more of the world's data is stored in databases, I expect that this time will pay rich dividends!

Front Matter The philosophical and technical underpinnings of this project.

Beazley's Last Statement Chapter 1 examines Napoleon Beazley's argument against capital punishment. We learn the structure of a SQL query and row operations on a table.

Claims of Innocence Chapter 2 estimates how many executed inmates may have been innocent. The technical theme is aggregating the entire table.

The Long Tail Chapter 3 studies counties with unusually high numbers of executions. We generalize Chapter 2 by applying aggregations on groups of rows.

Execution Hiatuses Chapter 4 explores extended periods when no executions have occurred. Its theme is extending the table using joins.