Learn databases,one step at a time.
Short lessons on a real Postgres, right in your browser. Guess what it will do, then watch it happen.
Try a step.
Every lesson is a few minutes of steps like this one. Pick an answer and a real Postgres runs it, right here.
Foreign keys: the row that points at nobody · predict
A shop records orders. Right now orders.customer_id is just a number, and there is no customer 9999.
INSERT INTO orders (customer_id) VALUES (9999);Will Postgres accept this order?
The board fills in when you answer.
A real database, about 5 MB the first time.
What you will learn.
4 levels and 35 lessons so far, each level ending on a boss. Foundations and Integrity are free, with no account.
Being written
Level 4
Indexes and the planner
Reading EXPLAIN, and the index that serves the query.
Level 5
Concurrency and queues
Two transactions at once, retries, and queues on Postgres.
Level 6
Changing schemas in production
Migrations that do not take the API down.
Level 7
Scale and architecture
Vacuum, replicas, partitions, tenants and shards.
You will guess wrong about Postgres a few times. Those are the guesses you remember.
Then design one on your own.
22 exercises give you a business problem and no pieces to pick from. You answer with a schema, and hidden tests run it on a real Postgres. 2 are free.
See the exercises
soft-delete-without-breaking-signups · 3/4
- PASSa signup is accepted
- PASStwo live accounts cannot share an email
- PASSa soft-deleted account keeps its address
- FAILthe address can be reused after deletion
A plain UNIQUE also counts the deleted row. The fix is one line.







