Normalization: splitting tables the right way in Access
One big table feels convenient until the same address sits in twenty rows and is spelled differently in one. Normalization means storing each fact exactly once and linking tables through keys.
In short: each table describes one thing (customers, orders, products). Whatever repeats goes into a table of its own and is referenced through a foreign key. A many-to-many relationship needs a junction table with a composite key.
Before you start: primary keys and table design from level 1, plus the level 2 project.
The problem with one table
Picture the dealer’s orders in one spreadsheet: per row the order number, date, customer name, customer address, product, quantity, price. If a customer orders ten times, their address appears ten times. When they move, you have to change ten rows; miss one and you have two addresses. Delete their only order and the customer is gone too. These errors are called anomalies, and normalization prevents them.
The three normal forms
| Normal form | Rule | Example of a violation |
|---|---|---|
| 1st normal form | Each field holds exactly one value, no repeating groups | A field “Contacts” with “Brandt, Kraus”, or columns Contact1, Contact2 |
| 2nd normal form | With a composite key, every field depends on the whole key | ProductName in a table keyed by OrderID + ProductID (it depends on ProductID only) |
| 3rd normal form | No field depends on another non-key field | Category name in Products (it depends on CategoryID, not on the product) |
The practice database follows this: Customers, Orders, OrderDetails, Products and Categories are five tables linked by IDs.
Try it: a table for the many side
Instead of several contact columns, each contact gets a record of its own with CustomerID as the foreign key.
Task Business customers often have several contacts. Instead of columns like Contact1, Contact2, each contact gets a record in a table of its own, Contacts: ContactID (AutoNumber, primary key), CustomerID (Number, Long Integer, required) as foreign key, Name (Short Text, 50, required) and Phone (Short Text, 20).
Many-to-many and junction tables
A product can come from several suppliers, and a supplier delivers many products. One foreign key in either table cannot express that. The answer is a third table with one row per combination. Its primary key is made of both foreign keys. OrderDetails is exactly such a table between orders and products.
Task A product can come from several suppliers, and a supplier delivers many products. Create the junction table ProductSuppliers: ProductID (Number, Long Integer) and SupplierID (Number, Long Integer) together form the primary key, plus PurchasePrice (Currency).
This exercise is part of Premium.
Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.
See Premium Already Premium? Log in
The first exercise in this lesson is free.
In real Access
- Start on paper: which things exist (customers, products …)? Each becomes a table with its own primary key.
- For each one-to-many relationship, put a foreign key in the many table, with data type Number (Long Integer) if the one side’s key is an AutoNumber.
- For many-to-many, a junction table; select both fields and click Primary Key.
- For existing, unnormalized tables, Database Tools offers the Table Analyzer, which suggests how to split them.
Common mistakes
Foreign key as AutoNumber
The foreign key gets its values from the other table; it must not count up by itself. Number with Long Integer is right.
Storing calculated values
An “OrderTotal” column in Orders goes stale as soon as a line changes. A query calculates such values.
Splitting too far
Not every column needs its own table. A table of first names helps nobody; split out what repeats as a thing of its own with its own properties.
FAQ
Does a database always have to be in 3rd normal form?
For the data you maintain, it is a good target. For reports you can always combine tables again with queries, which is what the next lessons cover.
What is a foreign key?
A field that holds the primary key of another table, such as CustomerID in Orders. It tells Access which customer an order belongs to.