34 min read
Normalisation
A short set of checks — first, second, and third normal form — to stop repeating groups and facts that do not belong.
The last lesson showed the damage. This lesson is the method for avoiding it.
Normalisation is a set of checks you run on a table design. Each check is called a normal form. If the first check passes, the table is in first normal form (1NF). If the first three pass, it is in third normal form (3NF). Microsoft's Access design guidance treats those three as enough for most databases.
You do not start from the labels. You start from three questions:
- Does every box hold one value, not a list, and have we avoided Book1, Book2, Book3 columns?
- Does every extra fact depend on the whole identity of the row, not just part of it?
- Does every extra fact depend on that identity directly, not through some other extra fact?
Oliver Bennett puts George's newest sheet on the desk. Across the top: Member, Phone, Book1, Book2, Book3.
"Sophie has two titles already," he says to Amelia Hart. "What happens when she borrows a fourth? We do not add Book4. We change the shape."
| MembersWithBooks | ||||
|---|---|---|---|---|
First normal form — one value per box
First normal form asks for a simple grid.
Each box holds one value, not a comma-separated list.
You do not store the same kind of fact in repeating columns (Book1, Book2, Book3). When the number of books can grow, those extra columns always run out.
Each row can be identified.
The fix is the shape you already know: one loan per row, not one member with a handful of book columns.
| OneLoanPerRow | |||||
|---|---|---|---|---|---|
Functional dependency
Before the second and third checks, you need one idea: functional dependency.
If you know one field, you can work out another. In Members, MemberID 1 always goes with Sophie Walsh. We say FullName depends on MemberID.
On George's loan sheet, Phone always matches the member, not the book. Phone depends on MemberID, not on MemberID + BookID together. That is the kind of dependency the next two normal forms remove.
Second normal form — no partial dependency
Look at the 1NF sheet again. Suppose the identity of a row is the pair MemberID + BookID (this member, this book).
Phone does not describe that pair. It describes the member only. Title describes the book only. Both facts are copied onto every loan.
Second normal form says: if the identity is made of more than one field, every other fact must depend on the whole identity, not just a piece of it. Phone depends only on MemberID — that is a partial dependency. It does not belong on the loan row.
The everyday fix is the one Amelia already uses: Members holds the phone. Books holds the title. Loans holds MemberID, BookID, and the date.
Third normal form — no transitive dependency
Even after phones and titles have gone home, a table can still hide a copy.
Oliver wants a daily fine: adults £2.00, students £0.50. George types MembershipType and DailyFine on every member row. Sophie and Harry both show £2.00. If the board later changes the adult fine to £2.50, George must edit every adult. Miss one row, and two adults pay different rates.
DailyFine does not depend on MemberID. It depends on MembershipType. A fact that depends on another non-key fact is a transitive dependency. It does not belong in that table.
Third normal form says: extra facts must depend on the key, the whole key, and nothing but the key. DailyFine belongs in a small MembershipTypes table. Members only stores which type the person is.
| Members | |||
|---|---|---|---|
| MembershipTypes | |
|---|---|
Practice
Swipe or use the arrows to move between questions.
1 / 3
More lessons in Database Fundamentals · Next: Designing a Database · Previous: Redundant Data and Anomalies
