Small Example Schemas Worth Studying
A good way to learn table design is to study small, tidy examples. This showcase describes four schemas sized for practice. They are teaching examples we wrote for this page, not designs taken from any real company or product.
Schema 1: a small library
Tables: authors, books, members, loans
| Table | Key columns |
|---|---|
| authors | id, name |
| books | id, title, author_id |
| members | id, name, email |
| loans | id, book_id, member_id, borrowed_on, returned_on |
What it teaches: one-to-many (author to books), and an "event" table (loans) that links two other tables and records when something happened. returned_on is NULL while a book is still out, a nice example of NULL meaning "not yet".
Practice question: which books are currently on loan? (Hint: WHERE returned_on IS NULL.)
Schema 2: a recipe box
Tables: recipes, ingredients, recipe_ingredients
| Table | Key columns |
|---|---|
| recipes | id, name, servings |
| ingredients | id, name |
| recipe_ingredients | recipe_id, ingredient_id, quantity, unit |
What it teaches: many-to-many. A recipe uses many ingredients, and an ingredient appears in many recipes. The linking table also stores extra facts about the link, the quantity and unit.
Practice question: which recipes use eggs?
Schema 3: a to-do app
Tables: users, lists, tasks
| Table | Key columns |
|---|---|
| users | id, email |
| lists | id, user_id, title |
| tasks | id, list_id, title, done, due_on |
What it teaches: a chain of one-to-many relationships (user to lists to tasks), and CRUD on the tasks table. A UNIQUE rule on users.email prevents duplicate sign-ups.
Practice question: how many unfinished tasks does each user have? (Two joins and a GROUP BY.)
Schema 4: a club register
Tables: members, events, attendance
| Table | Key columns |
|---|---|
| members | id, name, joined_on |
| events | id, title, held_on |
| attendance | member_id, event_id |
What it teaches: a linking table with a two-column primary key, (member_id, event_id), so the same member cannot be marked present twice at one event.
Practice question: which members have not attended any event? (A LEFT JOIN with IS NULL.)
What these schemas share
- Every table has a primary key.
- Each fact lives in one place; names are not repeated across tables.
- Foreign key columns are named
<table>_id, which makes joins easy to read. - Tables are small enough to fill with sample data in a few minutes.
How to use them
- Pick one schema and create the tables in SQLite.
- Insert five to ten rows per table, made-up data only.
- Answer the practice question.
- Write two more questions of your own and answer them.
When you feel confident, try designing a fifth schema for your own hobby, then check it with the normalisation self-check.
A free learning page for beginners. Practise on a test database, never on real customer data, and check the official documentation for your database version.
Illustrative example: the organisations, people, projects and results described on this page are hypothetical. They do not describe a real client or engagement, and no consulting services are offered here.