Storing each fact once
Normalisation means storing each fact once. Spreadsheets break this rule all the time:
| campaign | channel | channel_owner |
|---|---|---|
| Spring Clean | Priya | |
| Summer Sale | Priya | |
| Trade Week | Trade Show | Tom |
Priya's name is typed against every email campaign. If she hands over to someone else, every row has to change, and one missed row leaves the data contradicting itself.
The fix is to split it: a channels table with one row per channel and its owner, and campaigns
that just say which channel they used.
CREATE TABLE channels AS
SELECT DISTINCT channel, channel_owner
FROM campaign_sheetThe rules of thumb:
- Each table is about one kind of thing (customers, orders, products).
- Each row has a key that identifies it.
- Every other column is a fact about that row, not about something it links to.
Brightwell's tables follow this: an order holds customer_id, not the customer's name and city.
That's why you've needed joins: they put the facts back together when you read them.