A systematic approach to decide whether a particular relation is in good form. Helps ensure correctness and maintainability. But might degrade query performance.
Normalization theory was introduced by Edgar F. Codd, the father of relational databases, in 1970.
“Good” Form?
A relation is in good form when it has these properties:
- easier to understand and to extend
- clear keys that uniquely identify tuples
- appropriate atomic domains for attributes
- functional dependencies that do not introduce partial or transitive redundancy
- constraints captured by a suitable normal form (1NF, 2NF, 3NF, BCNF, etc.) given the application needs.
A database is in a good form when all of its relations are in good form.
Normal Forms
Normal forms prevent anomalies.
Several normal forms are defined, each builds on the previous one and defines a set of rules. Consecutive normal forms ensure the relations are in a better form.
Each normal form defines a set of conditions. If one of the conditions are violated, the relation is said to be violate the normal form.
If a relation violates th normal form, it is violating th normal forms where .
1st Normal Form (1NF)
If all the below conditions are met, the relation is in 1NF:
- Row order is not used to convey information.
- Domain of any attribute contains values of a single type, not multiple types.
Not possible in relational DBMS. - It has a primary key.
- It has no repeating groups.
Violates 1NF
| StudentID | Name | Phones |
|---|---|---|
| 1 | Ann | 071, 077 |
| 2 | Bob | 070 |
Phones holds a repeating group
Decomposed
| StudentID | Name |
|---|---|
| 1 | Ann |
| 2 | Bob |
| StudentID | Phone |
|---|---|
| 1 | 071 |
| 1 | 077 |
| 2 | 070 |
Underlined columns form the primary key.
2nd Normal Form (2NF)
If all the below conditions are met, the relation is in 2NF:
- It’s in 1NF
- All non-key attributes must depend on the entire primary key.
If not, the relation must be decomposed into smaller relations.
Violates 2NF
| StudentID | CourseID | StudentName | Grade |
|---|---|---|---|
| 1 | DB | Ann | A |
| 1 | OS | Ann | B |
| 2 | DB | Bob | C |
StudentName depends on StudentID only (partial dependency)
Decomposed
| StudentID | StudentName |
|---|---|
| 1 | Ann |
| 2 | Bob |
| StudentID | CourseID | Grade |
|---|---|---|
| 1 | DB | A |
| 1 | OS | B |
| 2 | DB | C |
Underlined columns form the primary key.
3rd Normal Form (3NF)
If all the below conditions are met, the relation is in 3NF:
- It’s in 2NF
- All non-key attributes must depend only on the entire primary key.
Allows key attributes to depend on non-key attributes.
Aims to remove data redundancy.
Violates 3NF
| StudentID | Dept | DeptHead |
|---|---|---|
| 1 | CS | Dr. Lee |
| 2 | CS | Dr. Lee |
| 3 | EE | Dr. Kim |
StudentID → Dept → DeptHead (transitive dependency)
Decomposed
| StudentID | Dept |
|---|---|
| 1 | CS |
| 2 | CS |
| 3 | EE |
| Dept | DeptHead |
|---|---|
| CS | Dr. Lee |
| EE | Dr. Kim |
Underlined columns form the primary key.
Boyce-Codd Normal Form (BCNF)
Slightly stronger than 3NF. Can be thought of as 3.5NF.
If all the below conditions are met, the relation is in BCNF:
- It’s in 3NF
- All key attributes must depend on and only on the entire primary key.
Violates BCNF
| Student | Course | Instructor |
|---|---|---|
| Ann | DB | Lee |
| Bob | DB | Lee |
| Ann | OS | Kim |
| Cathy | DB | Park |
Instructor → Course, but Instructor is not a key. A course can have several instructors, so Course does not determine Instructor
Decomposed
| Student | Instructor |
|---|---|
| Ann | Lee |
| Bob | Lee |
| Ann | Kim |
| Cathy | Park |
| Instructor | Course |
|---|---|
| Lee | DB |
| Kim | OS |
| Park | DB |
Underlined columns form the primary key.
Fix for BCNF Violation
Suppose relation and a non-trivial functional dependency cause a violation of BCNF.
is decomposed into:
Why BCNF Is the Usual Target
Most designs stop at BCNF, or 3NF when dependency preservation is needed, even though 4NF and 5NF exist.
- Functional dependencies are the most common constraint.
BCNF removes the redundancy they cause. - Multivalued and join dependencies are rare.
They appear only when independent facts are stored together in 1 relation. - A careful ER model already avoids them.
Each independent multivalued fact becomes its own entity or relationship, so the resulting tables are usually in 4NF already. - Join dependencies are hard to spot.
They are not visible from the real-world constraints the way functional dependencies are. - Every extra decomposition adds joins.
Queries get slower for a small gain in redundancy.
4th Normal Form (4NF)
If all the below conditions are met, the relation is in 4NF:
- It’s in BCNF
- All multivalued dependencies must be multivalued dependencies on the key.
If not, the relation must be decomposed into smaller relations.
Violates 4NF
| Employee | Skill | Language |
|---|---|---|
| Ann | SQL | EN |
| Ann | SQL | FR |
| Ann | Java | EN |
| Ann | Java | FR |
Employee ↠ Skill and Employee ↠ Language are independent
Decomposed
| Employee | Skill |
|---|---|
| Ann | SQL |
| Ann | Java |
| Employee | Language |
|---|---|
| Ann | EN |
| Ann | FR |
Underlined columns form the primary key.
5th Normal Form (5NF)
If all the below conditions are met, the relation is in 5NF:
- It’s in 4NF
- It cannot be describable as the logical result of joining some other tables together.
Violates 5NF
| Supplier | Part | Project |
|---|---|---|
| S1 | P1 | J2 |
| S1 | P2 | J1 |
| S2 | P1 | J1 |
| S1 | P1 | J1 |
Equals the join of its 3 projections
Decomposed
| Supplier | Part |
|---|---|
| S1 | P1 |
| S1 | P2 |
| S2 | P1 |
| Part | Project |
|---|---|
| P1 | J2 |
| P2 | J1 |
| P1 | J1 |
| Project | Supplier |
|---|---|
| J2 | S1 |
| J1 | S1 |
| J1 | S2 |
Underlined columns form the primary key.