Now on Omarchy: read the manual without leaving your desktop
All practice

Postgres Practice

Hands-on lessons on the features real Postgres has beyond standard SQL - JSONB, arrays, RETURNING, upsert, CTEs, window functions, and recursive queries - against a real Postgres running in your browser.

Intermediate 0/12 complete

Postgres Practice

Twelve short, hands-on lessons on what Postgres adds on top of standard SQL. The first seven cover the everyday extras: a JSONB column for document-shaped data, arrays as a real column type, RETURNING to get a row back from an INSERT, UUID primary keys generated with gen_random_uuid(), and ON CONFLICT DO UPDATE for upserts. Lessons 8-12 go deeper into the analytical toolkit: CTEs with WITH (single, chained, and recursive) and window functions (RANK with PARTITION BY, LAG for month-over-month change). If you've done the SQL Practice module, this picks up where it leaves off - same Run-and-check format, but against a genuine Postgres instance (compiled to WebAssembly, running entirely in your browser - no server, no setup).

Start with lesson 1. You can leave and come back any time - your code is saved locally.

Lessons

12 total
  1. 01 JSONB: read fields out of a JSON column
  2. 02 JSONB: filter rows with @>
  3. 03 Arrays: a column that holds a list
  4. 04 RETURNING: get the row back from an INSERT
  5. 05 UUID primary keys with gen_random_uuid()
  6. 06 Upsert: ON CONFLICT DO UPDATE
  7. 07 Fix the bug: Postgres's strict GROUP BY
  8. 08 CTEs: naming a step with WITH
  9. 09 Chaining CTEs
  10. 10 Window functions: RANK with PARTITION BY
  11. 11 LAG: comparing to the previous row
  12. 12 Recursive CTEs (capstone)