Normalisation Basics, Written Out: Untangling a Messy Spreadsheet
Normalisation is easiest to understand by doing it. In this written walkthrough, organised in chapters like a short video (no video is published), we take a messy club spreadsheet and turn it into tidy tables.
Chapter 1: the mess
A running club tracks members and their races in one sheet:
| member | races | coach | coach_phone | |
|---|---|---|---|---|
| Ana | ana@example.org | 5k, 10k | Sam | 0700 000 001 |
| Ben | ben@example.org | 10k | Sam | 0700 000 001 |
| Cleo | cleo@example.org | 5k, half marathon | Rita | 0700 000 002 |
(The phone numbers are made-up placeholders.) Notice two problems: the races cells hold lists, and coach details repeat on every row.
Chapter 2: one value per cell
First rule: no lists in cells. We give each member-race pair its own row:
| member | race |
|---|---|
| Ana | 5k |
| Ana | 10k |
| Ben | 10k |
| Cleo | 5k |
| Cleo | half marathon |
Now "who ran the 10k?" is a simple filter instead of a text search through commas.
Chapter 3: one fact in one place
Sam's phone number appears on every row for Sam's runners. If it changes, we must edit many rows. So coaches get their own table:
| coach_id | name | phone |
|---|---|---|
| 1 | Sam | 0700 000 001 |
| 2 | Rita | 0700 000 002 |
Members point to their coach by id:
| member_id | name | coach_id | |
|---|---|---|---|
| 1 | Ana | ana@example.org | 1 |
| 2 | Ben | ben@example.org | 1 |
| 3 | Cleo | cleo@example.org | 2 |
Chapter 4: races as their own thing
Race names are typed by hand in the pairs table, so "10k" and "10 k" could sneak in. We make a races table and link to it:
| race_id | name |
|---|---|
| 1 | 5k |
| 2 | 10k |
| 3 | half marathon |
And the pairs become ids only:
| member_id | race_id |
|---|---|
| 1 | 1 |
| 1 | 2 |
| 2 | 2 |
| 3 | 1 |
| 3 | 3 |
This "pairs" table is called a linking table (or junction table). It records a many-to-many relationship: a member runs many races, and a race has many members.
Chapter 5: the SQL
CREATE TABLE coaches (coach_id INTEGER PRIMARY KEY, name TEXT NOT NULL, phone TEXT);
CREATE TABLE members (member_id INTEGER PRIMARY KEY, name TEXT NOT NULL, email TEXT UNIQUE,
coach_id INTEGER REFERENCES coaches(coach_id));
CREATE TABLE races (race_id INTEGER PRIMARY KEY, name TEXT NOT NULL UNIQUE);
CREATE TABLE member_races (member_id INTEGER REFERENCES members(member_id),
race_id INTEGER REFERENCES races(race_id),
PRIMARY KEY (member_id, race_id));
Chapter 6: getting the full picture back
Splitting does not lose anything; a JOIN puts it back together:
SELECT m.name, r.name AS race, c.name AS coach
FROM member_races mr
JOIN members m ON m.member_id = mr.member_id
JOIN races r ON r.race_id = mr.race_id
JOIN coaches c ON c.coach_id = m.coach_id
ORDER BY m.name;
What we gained
| Before | After |
|---|---|
| Lists inside cells | One value per cell |
| Coach phone repeated | Stored once |
| Race names typed many times | One races table with unique names |
| Hard to add a coach with no runners | Just add a coaches row |
For the reasoning behind each step, read inside normalisation: why we split data into tables.
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 outline only: no live session, recording, registration or certificate is offered on this site. Any speakers, panels or schedules mentioned are hypothetical.