First Normal Form (1NF)
Goal:
- Eliminate repeating groups.
- Make sure each field contains atomic (indivisible) values.
A table NOT in 1NF:
| student_id | name | courses |
|---|---|---|
| 1 | Alice | Math, History |
| 2 | Bob | Math |
Problem:
courseshas multiple values in one column — this is not atomic.
Fix — Table in 1NF:
Break it into one row per course:
| student_id | name | course |
|---|---|---|
| 1 | Alice | Math |
| 1 | Alice | History |
| 2 | Bob | Math |
✅ Each field contains atomic values.
✅ No multi-valued columns.
Second Normal Form (2NF)
Goal:
- Be in 1NF AND
- Eliminate partial dependencies (no attribute should depend only on part of a composite primary key).
A table in 1NF but NOT in 2NF:
Assume the primary key is (student_id, course).
| student_id | course | student_name |
|---|---|---|
| 1 | Math | Alice |
| 1 | History | Alice |
| 2 | Math | Bob |
Problem:
student_namedepends only onstudent_id, not on the whole key(student_id, course).- This is a partial dependency.
Fix — Table in 2NF:
Split into two tables:
Students
| student_id | student_name |
|---|---|
| 1 | Alice |
| 2 | Bob |
Enrollments
| student_id | course |
|---|---|
| 1 | Math |
| 1 | History |
| 2 | Math |
✅ Now every non-key column depends on the whole primary key.
Third Normal Form (3NF)
Goal:
- Be in 2NF AND
- Eliminate transitive dependencies (non-key columns must depend only on the primary key, not on other non-key columns).
A table in 2NF but NOT in 3NF:
| student_id | student_name | student_zipcode | zipcode_city |
|---|---|---|---|
| 1 | Alice | 12345 | New York |
| 2 | Bob | 67890 | Los Angeles |
Problem:
zipcode_citydepends onstudent_zipcode, not directly onstudent_id.- This is a transitive dependency:
student_id → student_zipcode → zipcode_city.
Fix — Table in 3NF:
Split into two tables:
Students
| student_id | student_name | student_zipcode |
|---|---|---|
| 1 | Alice | 12345 |
| 2 | Bob | 67890 |
Zipcodes
| student_zipcode | zipcode_city |
|---|---|
| 12345 | New York |
| 67890 | Los Angeles |
✅ Now, all non-key columns depend only on the primary key.
Summary Table
| Normal Form | What It Fixes | Requirement |
|---|---|---|
| 1NF | Repeating groups, multivalued columns | Atomic values (no lists or sets inside fields). |
| 2NF | Partial dependencies | No non-key column depends on part of a composite key. |
| 3NF | Transitive dependencies | No non-key column depends on another non-key column. |
🎯 In Simple Words:
- 1NF: One value per cell.
- 2NF: No partial key dependency.
- 3NF: No indirect dependency.