
Author
Dariush Abbasi
Author of Postgres by Example, published on GitHub under CC BY 4.0 with the explanations and SQL examples side by side.
Dariush Abbasi · PostgreSQL 17
Fifty-seven short lessons take you from the first query through data modeling, querying, indexes, transactions, stored logic, search, and day-to-day operations.

Author
Author of Postgres by Example, published on GitHub under CC BY 4.0 with the explanations and SQL examples side by side.
Prerequisites
The lessons target PostgreSQL 17 and the psql client. Later-version features are identified explicitly; the official documentation is a useful companion.
Download the complete SQL bundle, extract it into a new directory, and run commands from the directory containing source/.
The lessons create, change, and drop their demo tables, so use a disposable database and substitute it for postgres in the examples:
Read in chapter order. Before chapter 6, create the sample table using the files introduced in chapters 16 and 24:
Chapter 16 recreates the table; chapter 24 fills it again. Later join lessons depend on chapter 29, and the recursive example also uses chapter 31. When skipping ahead, follow the lesson’s prerequisites. Optional exercises can change later results. Dates, UUIDs, catalog listings, query plans, and timings vary; ellipses in console transcripts mark omitted output.
Chapter 46 deliberately raises a duplicate-key error: run it with ON_ERROR_STOP=off so the subsequent rollback and cleanup execute. For chapter 55, use a non-superuser database owner without BYPASSRLS; superusers bypass row security even with FORCE ROW LEVEL SECURITY.
Contents
Editions
Postgres by Example by Dariush Abbasi is published in boringcollege/postgres-by-example under CC BY 4.0. This edition is based on commit ffde0d3; reviewed technical changes are listed in Editorial Corrections, and sources and licenses in Publication and License.