Database Normalization Basics
Database Normalization Notes
What is Normalization?
Normalization is the process of structuring a relational database table so that it cannot express redundant or contradictory information. In a normalized table, the design prevents logically impossible data — for example, one customer cannot have two different dates of birth. This is a failure of data integrity that normalization aims to prevent.
Normalized database tables offer several benefits:
Protected from contradictory data — only one version of the truth can be stored
Easier to understand — the structure clearly represents the real-world relationships
Easier to enhance and extend — adding new attributes or entities is straightforward
Protected from insertion, update, and deletion anomalies — data remains consistent when rows are added, changed, or removed
The level of normalization is assessed using criteria called normal forms. These are analogous to safety assessments for a bridge:
Level 1: Safe for pedestrian traffic (basic guarantee)
Level 2: Safe for cars (stricter guarantee)
Level 3: Safe for trucks (even stricter)
Similarly, a table that meets First Normal Form (1NF) provides a minimum safety guarantee. Meeting higher normal forms (2NF, 3NF, BCNF, 4NF, 5NF) provides progressively stronger guarantees against redundancy and anomalies.
First Normal Form (1NF)
First Normal Form is the most basic level of normalization. A table violates 1NF in four ways:
1. Using Row Order to Convey Information
In a relational database, there is no inherent row order. The order in which rows are returned by a query is arbitrary. If the design relies on the position of a row to convey meaning (e.g., listing members from tallest to shortest), that meaning is lost or ambiguous.
Solution: Add an explicit column to store the information (e.g., a Height_In_Cm column).
Rule: Row order must not be used to convey information.
2. Mixing Data Types Within a Column
A column in a relational database has a single, defined data type (integer, string, date, etc.). Storing different data types in the same column (e.g., some values as integers and others as text) violates 1NF. In practice, most database platforms enforce this rule automatically.
Rule: Each column must contain values of only one data type.
3. Having a Table Without a Primary Key
A primary key is a column (or combination of columns) that uniquely identifies each row in the table. Without a primary key, duplicate or contradictory rows could be inserted — for example, two rows for the same Beatle with different heights.
Solution: Designate a primary key column (e.g., Beatle as the primary key in a Beatle_Height table). The database platform will then prevent duplicate rows for the same key value.
Rule: Every table must have a primary key.
4. Storing Repeating Groups
A repeating group occurs when a single row contains multiple values of the same type of data — for example, listing all items in a player's inventory as a single text string or as multiple columns (Item1, Item2, Item3, …). This makes querying very difficult (e.g., finding which players have more than 10 copper coins) and is impractical when the number of items can be large or unknown.
Solution: Use a separate table where each row represents one instance of the repeating group. For a player inventory:
Player | Item_Type | Item_Quantity |
|---|---|---|
trev73 | shields | 3 |
trev73 | arrows | 5 |
jdog21 | amulets | 2 |
... | ... | ... |
The primary key becomes the combination of Player and Item_Type.
Rule: Repeating groups must be moved to their own table with one row per occurrence.
Summary of First Normal Form Rules
Row order must not convey information.
Each column must have a single data type.
Every table must have a primary key.
Repeating groups are not permitted.
Second Normal Form (2NF)
A table is in Second Normal Form if it is in 1NF and every non-key attribute is dependent on the entire primary key (i.e., there are no partial dependencies).
What is a Partial Dependency?
A partial dependency occurs when a non-key attribute depends only on part of a composite primary key, not the whole key.
Example: Player_Inventory with Player_Rating
Consider a table that extends the player inventory to include each player's rating (Beginner, Intermediate, Advanced):
Player | Item_Type | Item_Quantity | Player_Rating |
|---|---|---|---|
jdog21 | amulets | 2 | Intermediate |
jdog21 | arrows | 5 | Intermediate |
trev73 | shields | 3 | Advanced |
trev73 | arrows | 0 | Advanced |
trev73 | potions | 4 | Advanced |
trev73 | swords | 1 | Advanced |
The primary key is the composite (Player, Item_Type).
Item_Quantity depends on the entire primary key: each combination of Player and Item_Type has exactly one quantity. This is fine.
Player_Rating depends only on Player (part of the primary key), not on Item_Type. This is a partial dependency and violates 2NF.
Anomalies Caused by Partial Dependencies
Deletion anomaly: If a player loses all inventory items, the only row(s) for that player are deleted, and their rating information is lost.
Update anomaly: If a player's rating changes, all rows for that player must be updated. An incomplete update leaves the player with contradictory ratings (e.g., both Intermediate and Advanced).
Insertion anomaly: A new player with no inventory cannot be entered into the table because there is no way to provide a primary key value for Item_Type.
Fix: Split into Two Tables
Create a separate Player table for player-specific attributes:
Player Table:
Player_ID | Player_Rating |
|---|---|
jdog21 | Intermediate |
trev73 | Advanced |
Player_Inventory Table (unchanged from 1NF version):
Player_ID | Item_Type | Item_Quantity |
|---|---|---|
trev73 | shields | 3 |
trev73 | arrows | 5 |
jdog21 | amulets | 2 |
... | ... | ... |
Now every non-key attribute depends on the entire primary key in its own table.
Rule for 2NF: Each non-key attribute must be dependent on the whole primary key, not just a part of it.
Third Normal Form (3NF)
A table is in Third Normal Form if it is in 2NF and no non-key attribute is transitively dependent on the primary key (i.e., there are no dependencies on other non-key attributes).
What is a Transitive Dependency?
A transitive dependency occurs when a non-key attribute depends on another non-key attribute, which in turn depends on the primary key.
Example: Player Table with Skill Level and Rating
Extend the Player table to include a Player_Skill_Level (1–9) and Player_Rating (Beginner/Intermediate/Advanced), with the mapping:
Skill 1–3 → Beginner
Skill 4–6 → Intermediate
Skill 7–9 → Advanced
Player Table:
Player_ID | Player_Rating | Player_Skill_Level |
|---|---|---|
gila19 | Beginner | 3 |
jdog21 | Intermediate | 5 |
trev73 | Advanced | 8 |
Player_Rating depends on Player_ID (primary key) — but only indirectly via Player_Skill_Level.
The dependency chain is:
Player_ID → Player_Skill_Level → Player_RatingPlayer_Rating is transitively dependent on the primary key.
This allows data inconsistency: if only Player_Skill_Level is updated to 4 (Intermediate) but Player_Rating is not changed, the table would show a player with Skill 4 but Rating "Beginner" — logically impossible.
Fix: Remove Transitive Dependencies
Split the transitive chain into two tables:
Player Table:
Player_ID | Player_Skill_Level |
|---|---|
gila19 | 3 |
jdog21 | 5 |
trev73 | 8 |
Player_Skill_Levels Table (mapping table):
Skill_Level | Player_Rating |
|---|---|
1 | Beginner |
2 | Beginner |
3 | Beginner |
4 | Intermediate |
5 | Intermediate |
6 | Intermediate |
7 | Advanced |
8 | Advanced |
9 | Advanced |
Now every non-key attribute depends directly on the key, with no transitive dependencies.
Rule for 3NF: Every non-key attribute in a table must depend on the key, the whole key, and nothing but the key.
Boyce-Codd Normal Form (BCNF)
Boyce-Codd Normal Form is a slightly stronger version of 3NF. The rule simplifies to: Every attribute in a table must depend on the key, the whole key, and nothing but the key. (Note: the phrase "non-key" is dropped.) In practice, almost every table that meets 3NF also meets BCNF. The rare exceptions involve tables with multiple overlapping candidate keys, which are beyond most practical database design work.
Practical guideline: Strive to satisfy "the key, the whole key, and nothing but the key" for every attribute. This typically achieves both 3NF and BCNF.
Fourth Normal Form (4NF)
A table is in Fourth Normal Form if it is in BCNF (or 3NF) and contains no non-trivial multivalued dependencies that are not implied by the key.
What is a Multivalued Dependency?
A multivalued dependency exists when one attribute (or set of attributes) determines a set of values for another attribute, independently of other attributes. It is written as A↠B.
Example: Birdhouse Models, Colors, and Styles
DesignMyBirdhouse.com allows customers to choose from different birdhouse models, each with its own set of available colors and available styles. The colors and styles are independent — any combination of an available color and an available style for a given model should be valid.
Table: Model_Colors_And_Styles_Available
Model | Color | Style |
|---|---|---|
Prairie | brown | bungalow |
Prairie | brown | schoolhouse |
Prairie | beige | bungalow |
Prairie | beige | schoolhouse |
... | ... | ... |
This table is in 3NF. The primary key is (Model, Color, Style). All attributes depend on the full key. However, there is a multivalued dependency: each model has a set of colors, and each model has a set of styles. These sets are independent: Model \twoheadrightarrow Color and Model \twoheadrightarrow Style.
Because Model is not the key, these multivalued dependencies cause redundancy and potential anomalies. If a new color "green" is introduced for the Prairie model, two rows must be added (one for each style). If only one row is added, the data implies that green is available only for the bungalow style, not the schoolhouse — a logical inconsistency.
Fix: Separate the Independent Sets
Split the table into two tables, each with a multivalued dependency on the key:
Model_Colors_Available:
Model | Color |
|---|---|
Prairie | brown |
Prairie | beige |
Prairie | green |
Model_Styles_Available:
Model | Style |
|---|---|
Prairie | bungalow |
Prairie | schoolhouse |
Now, adding green for the Prairie model requires only one row in the Model_Colors_Available table, and the available styles are kept in a separate table. No combination information is stored redundantly.
Rule for 4NF: The only multivalued dependencies allowed in a table are those that are implied by the key (i.e., the key determines the set). All other multivalued dependencies must be separated into their own tables.
Fifth Normal Form (5NF)
A table is in Fifth Normal Form (also called Project-Join Normal Form) if it is in 4NF and cannot be decomposed into smaller tables without losing information. In other words, the table is the result of joining two or more tables, and storing the joined form would introduce redundancy.
Example: People, Brands, and Flavors of Ice Cream
Three ice cream brands offer specific flavors:
Frosty's: vanilla, chocolate, strawberry, mint chocolate chip
Alpine: vanilla, rum raisin
Ice Queen: vanilla, strawberry, mint chocolate chip
Two people have brand and flavor preferences:
Jason: likes only vanilla and chocolate; likes only Frosty's and Alpine.
Suzy: likes only rum raisin, mint chocolate chip, and strawberry; likes only Alpine and Ice Queen.
From this, we can deduce which specific products each person would eat. This can be stored in a table like:
Person | Brand | Flavor |
|---|---|---|
Jason | Frosty's | vanilla |
Jason | Frosty's | chocolate |
Jason | Alpine | vanilla |
Suzy | Alpine | rum raisin |
Suzy | Alpine | mint chocolate chip |
Suzy | Ice Queen | strawberry |
Suzy | Ice Queen | mint chocolate chip |
This table is in 4NF. However, it contains join dependency — the data can be derived by joining three separate tables:
Brand_Flavors: which brands offer which flavors
Person_Brands: which people like which brands
Person_Flavors: which people like which flavors
If Suzy later decides she also likes Frosty's, all new combinations must be added correctly. Adding only one row (e.g., Suzy–Frosty's–strawberry) but missing another (Suzy–Frosty's–mint chocolate chip) creates an inconsistency, because the brand–flavor combination exists and Suzy likes both the brand and the flavor, so logically she should like the product.
Fix: Decompose into Three Tables
Instead of storing the deduced combinations, store the base facts separately:
Brand_Flavors:
Brand | Flavor |
|---|---|
Frosty's | vanilla |
Frosty's | chocolate |
Frosty's | strawberry |
Frosty's | mint chocolate chip |
Alpine | vanilla |
Alpine | rum raisin |
Ice Queen | vanilla |
Ice Queen | strawberry |
Ice Queen | mint chocolate chip |
Person_Brands:
Person | Brand |
|---|---|
Jason | Frosty's |
Jason | Alpine |
Suzy | Alpine |
Suzy | Ice Queen |
Suzy | Frosty's |
Person_Flavors:
Person | Flavor |
|---|---|
Jason | vanilla |
Jason | chocolate |
Suzy | rum raisin |
Suzy | mint chocolate chip |
Suzy | strawberry |
Now, when Suzy adds Frosty's, a single row is added to Person_Brands. No new combination rows are needed. The complete list of products Suzy would eat can be produced by joining Person_Brands and Person_Flavors with Brand_Flavors.
Rule for 5NF: A table is in 5NF if it cannot be decomposed into two or more tables that would require a join to recover the original information without introducing redundancy. In practice, ensure that every fact is stored only once and that tables represent independent relationships.
Summary of Normal Forms
For a table to be in a given normal form, it must also satisfy all lower normal forms.
Normal Form | Rule |
|---|---|
1NF | 1. Row order must not convey information. 2. Each column must have a single data type. 3. Every table must have a primary key. 4. Repeating groups are not permitted. |
2NF | Every non-key attribute must depend on the entire primary key (no partial dependencies). |
3NF | Every non-key attribute must depend on the key, the whole key, and nothing but the key (no transitive dependencies). |
BCNF | Every attribute must depend on the key, the whole key, and nothing but the key (a slightly stronger version of 3NF). |
4NF | No non-trivial multivalued dependencies exist that are not implied by the key. |
5NF | The table cannot be decomposed into separate tables without losing information (i.e., it does not contain a join dependency). |
In practice, achieving 3NF (or BCNF) is sufficient for the vast majority of database designs. Fourth and Fifth Normal Forms address edge cases where independent multivalued or join dependencies would cause redundancy even in 3NF tables. Following the rule "every attribute depends on the key, the whole key, and nothing but the key" will guide most designs correctly.

Ask anything
We've read this whole study set, so questions about it get the best answers.