36 min read
Putting It Together
Design the library database step by step — entities, keys, relationships, redundancy, normalisation — then practise on the Bristol branch transfer.
Start from the mess
At Riverside Public Library in York, staff typed one mixed afternoon sheet: member names, phones, book titles, locker locations, and loan dates — all on one list.
Read it carefully. Your job is to decide what kinds of thing the library actually has, and which facts belong together. The finished tables and diagrams come only at the end, after you have worked through the steps.
| Staff afternoon sheet | ||||
|---|---|---|---|---|
Step 1 — name the entities
An entity is what a table is about — one type of thing. Members are people who joined. Books are titles on the shelf. Loans are borrows. Lockers are storage spaces assigned to members.
A chat thread or George's mixed sheet is not an entity. The sheet is the problem you are fixing.
Practice
Select every entity the library needs.
Step 2 — give each table an identity
Each table needs a primary key: a field that uniquely identifies every row. Names fail when two people share a name — there are two Sophie Walshes, in York and London. Phones can change.
The library assigns its own numbers: MemberID, BookID, LoanID, LockerID.
Practice
Swipe or use the arrows to move between questions.
1 / 2
Step 3 — draw the honest lines
Where a fact on one list must match a fact on another, you store a foreign key and draw a line on purpose.
- Loans.MemberID matches Members.MemberID — ONE member, MANY loans.
- Loans.BookID matches Books.BookID — ONE book, MANY loan records over time.
- Lockers.MemberID matches Members.MemberID — ONE member, ONE locker.
Practice
Connect Members.MemberID to Loans.MemberID, Books.BookID to Loans.BookID, and Members.MemberID to Lockers.MemberID.
Drag from a key on the right of one table onto a key on the left of another. Delete a line with Backspace.
Step 4 — spot the extra copies
On the afternoon sheet, Sophie's phone appears on every loan line. Her locker location is copied twice. Those are redundant copies — the same fact stored more than once.
If Sophie changes her phone, staff must find every copy. Miss one, and the sheet disagrees with itself. That is an update anomaly.
Practice
Step 5 — check the normal forms
First normal form (1NF): one value per box — no Book1, Book2, Book3 columns. Extra borrows are extra rows on Loans.
Second normal form (2NF): facts on a row depend on the whole key. Phone depends on MemberID, not on LoanID.
Third normal form (3NF): no fact hanging off another non-key fact. If a fine depends on membership type, store the type list separately.
Practice
Your turn — Bristol branch transfer
Riverside Public Library is opening a small branch in Bristol. The transfer pack lists what the new site must store — members across York, Bristol, Manchester, Leeds, and London; books including The River Path and Bristol Harbour; loans with dates; lockers with locations.
Work through the questions below without scrolling to the finished tables and diagrams at the end. Same method as York. Different building.
| Bristol branch opening notes |
|---|
Practice
Swipe or use the arrows to move between questions.
1 / 4
The finished picture
If your answers matched the steps above, you already hold the whole design in your head. Here is the official picture — after the work, not before.
Four tables. Numbers identify. Numbers point. No copied phones on loan rows. The same design serves York and Bristol.
Click the table name, a column heading, or any value. Each piece has a job.
Click the table name, a column heading, or any value. Each piece has a job.
Click the table name, a column heading, or any value. Each piece has a job.
Click the table name, a column heading, or any value. Each piece has a job.
Loans in the middle
The bar marks the ONE side (the primary key). The three lines mark the MANY side (the foreign key). The line joins those two fields — it is not a flow of data.
Click a key icon, a field name, or a relationship line to highlight the matching fields.
Members, books, and loans
The whole library, including lockers
More lessons in Database Fundamentals · Next: Course Exam · Previous: Indexing
