Book Exercise Lanes
This module's exercise system is book-driven and tool-driven. Use these lanes for targeted volume after you have already learned the concept from the guide.
How To Use This Page
- Finish the relevant concept page first.
- Solve at least one query / schema design from memory against a seeded PostgreSQL database.
- Only then open the matching exercise lane.
- Keep a mistake log with tags such as
three-valued-logic bug,join direction flipped,missing GROUP BY column,non-sargable predicate,wrong isolation level,cascade direction wrong,N+1,non-repeatable read,violated constraint at runtime.
Lane 1: The Relational Model and Relational Algebra
Use this lane when the issue is translating English to algebra or algebra to SQL.
- Silberschatz: Structure of relational databases
- Silberschatz: Database schema
- Silberschatz: Keys
- Silberschatz: Schema diagrams
- Silberschatz: Relational algebra, parts 1-4
Target outcomes:
- 10 English-to-algebra translations across selection, projection, join, union, difference
- 10 algebra-to-SQL translations on a schema you designed
- 5 written "which is the primary key and why" arguments
- 2 "this relation is not a set because..." corrections of a starter schema
Lane 2: SQL Query Writing
Use this lane when the issue is translating a requirement into correct, efficient SQL.
- Silberschatz: Basic structure of SQL queries, parts 1-2
- Silberschatz: Additional basic operations
- Silberschatz: Set operations
- Silberschatz: Null values
- Silberschatz: Aggregate functions
- Silberschatz: Nested subqueries
- Silberschatz: Join expressions
- PGExercises - getting started
- PGExercises - aggregates
- PGExercises - joins and subqueries
- SQLZoo - SELECT from WORLD
Target outcomes:
- 25 PGExercises problems solved
- 10 self-written queries on your own schema across the 5 question shapes: filter, aggregate, anti-join, top-N-per-group, recursive CTE
- 5 written "the naive query was wrong because NULL / duplicates / grouping..." corrections
Lane 3: Schema Design and Normalization
Use this lane when you can write SQL but cannot defend your schema.
- Silberschatz: Features of good relational designs
- Silberschatz: Decomposition using FDs, part 1
- Silberschatz: Normal forms, parts 1-3
- Silberschatz: Functional dependency theory, parts 1-4
- Silberschatz: Algorithms for decomposition
- Silberschatz: Reducing ER diagrams to relational schemas, parts 1-3
- Silberschatz: Extended ER features, parts 1-3
Target outcomes:
- 6 normalize-this-table exercises (to 3NF and, when different, to BCNF) with lossless-decomposition checks
- 3 full ER diagrams translated to DDL for domains you chose
- 2 written "this schema has the following anomaly risk; here is the denormalization tradeoff" memos
Lane 4: Constraints, DDL, and Migrations
Use this lane when the issue is enforcing invariants in the database or evolving the schema without downtime.
- Silberschatz: SQL data definition
- Silberschatz: Integrity constraints, parts 1-3
- Silberschatz: SQL data types and schemas, part 1
- Silberschatz: Views, parts 1-2
- Silberschatz: Materialized views, parts 1-2
- Silberschatz: Functions and procedures, part 1
- Silberschatz: Triggers, part 1
- DDIA: The merits of schemas
- PostgreSQL docs: ALTER TABLE
Target outcomes:
- DDL for 3 domains with every row-level invariant declared as
NOT NULL,UNIQUE,CHECK, orFOREIGN KEY - 3 expand-backfill-cut-over-contract plans for real migration shapes (rename, split, retype)
- 2
CREATE VIEW+ 1CREATE MATERIALIZED VIEW+ 1CREATE FUNCTIONon your schema, each with a one-sentence rationale
Lane 5: Query Performance and Transactions
Use this lane when queries are correct but slow, or when concurrency bites.
- Silberschatz: Query processing overview (15.1)
- Silberschatz: Measures of query cost, parts 1-2
- Silberschatz: Selection operation, part 1
- Silberschatz: Join operation, parts 1-6
- Silberschatz: Transformation of relational expressions, parts 1-3
- Silberschatz: Choice of evaluation plans, parts 1-3
- Silberschatz: Index definition in SQL
- Silberschatz: Transaction concept (17.1)
- Silberschatz: Transaction isolation (17.5)
- Silberschatz: Transaction isolation levels (17.8)
- Silberschatz: Transactions as SQL statements (17.10)
- DDIA: Chapter 7 - Transactions
- Use The Index, Luke - full archive
Target outcomes:
- 6 before/after
EXPLAIN ANALYZEcomparisons on your schema with the index or rewrite that caused the change - 3 N+1 rewrites in pseudocode with the corresponding SQL single-query version
- 3 isolation-level experiments in two
psqlsessions (lost update, non-repeatable read, write skew if feasible) with written conclusions - 2 written "this query looked cheap but was dominated by X" post-mortems
How To Handle A Gap
When you get stuck and none of the lanes click:
- Restate the task in one sentence.
- State which cluster(s) it sits in.
- Open only the referenced chunks for those clusters.
- If still stuck, open the authoritative external resource (PostgreSQL docs or Use The Index, Luke).
- Record the gap in your mistake log.