Understanding 1NF, 2NF, and 3NF through real-world examples
Grade XII • Computer Science ⏱️ ~25 minBrief Intro — Database Normalization
Normalization is the art of organizing a database to eliminate redundant data and prevent errors when adding, updating, or deleting information. By following a set of strict "Normal Forms," you ensure your data remains consistent and your database stays efficient as it grows.
In this activity, you'll learn how to transform messy tables into clean, professional structures using 1NF, 2NF, and 3NF.
Prerequisites
By the end of this activity, you will be able to:
At its core, normalization is about reducing data redundancy to make databases easier to maintain and less prone to errors.
Normalization is the process of organizing a database table to reduce redundancy and avoid anomalies (insertion, update, and deletion problems). It happens in stages:
The first step of normalization ensures that every cell in a table holds only a single, atomic piece of information.
Example: EMPLOYEE table (not in 1NF)
Notice that EMP_PHONE contains multiple values for some employees.
| EMP_ID | EMP_NAME | EMP_PHONE | EMP_PROVINCE |
|---|---|---|---|
| 14 | Ram | 7272826385, 9064738238 | Bagmati |
| 20 | Sita | 8574783832 | Koshi |
| 12 | Hari | 7390372389, 8589830302 | Gandaki |
Problem: EMP_PHONE has multiple values in a single cell. This violates 1NF, which requires every cell to hold a single atomic value.
Fix: Split multi-valued cells into separate rows.
| EMP_ID | EMP_NAME | EMP_PHONE | EMP_PROVINCE |
|---|---|---|---|
| 14 | Ram | 7272826385 | Bagmati |
| 14 | Ram | 9064738238 | Bagmati |
| 20 | Sita | 8574783832 | Koshi |
| 12 | Hari | 7390372389 | Gandaki |
| 12 | Hari | 8589830302 | Gandaki |
Exercise 1.1 — Which normal form removes multi-valued attributes?
Exercise 1.2 — What is the primary key of the 1NF EMPLOYEE table above?
Reaching 2NF requires removing partial dependencies, ensuring that every piece of data depends on the entire primary key.
Example: TEACHER table (not in 2NF)
The primary key is (TEACHER_ID, SUBJECT) — a composite key.
| TEACHER_ID | SUBJECT | TEACHER_AGE |
|---|---|---|
| 25 | Chemistry | 30 |
| 25 | Biology | 30 |
| 47 | English | 35 |
| 83 | Math | 38 |
| 83 | Computer | 38 |
Problem: TEACHER_AGE depends only on TEACHER_ID, not on SUBJECT. Since the primary key is composite, this is a partial dependency.
Fix: Split into two tables.
Now TEACHER_AGE depends on the entire key of its own table (just TEACHER_ID). No partial dependency remains.
Exercise 2.1 — Partial dependency is only possible when the primary key is:
Exercise 2.2 — In the TEACHER table, TEACHER_AGE depends on:
3NF takes organization further by eliminating transitive dependencies, ensuring no data depends on other non-key columns.
Example: EMPLOYEE_DETAIL table (not in 3NF)
The primary key is EMP_ID (a single column).
| EMP_ID | EMP_NAME | EMP_ZIP | EMP_PROVINCE | EMP_CITY |
|---|---|---|---|---|
| 222 | Hari | 44600 | Bagmati | Kathmandu |
| 333 | Sita | 44200 | Bagmati | Bharatpur |
| 444 | Lakhan | 56700 | Koshi | Dharan |
| 555 | Krishna | 33700 | Gandaki | Pokhara |
| 666 | Jivan | 22400 | Lumbini | Ghorahi |
Problem: EMP_PROVINCE and EMP_CITY depend on EMP_ZIP, not directly on EMP_ID. Since EMP_ZIP is a non-key column, this is a transitive dependency: EMP_ID → EMP_ZIP → EMP_PROVINCE.
Fix: Split into two tables.
Now EMP_PROVINCE and EMP_CITY depend on EMP_ZIP, which is the primary key of its own table. No transitive dependency remains.
Exercise 3.1 — EMP_PROVINCE depends on EMP_ZIP. This is an example of:
Exercise 3.2 — 3NF removes _____ dependency.
Normalization solves three critical data anomalies — insertion, update, and deletion — that can otherwise corrupt your database information.
Match each anomaly to its description
Exercise 4.1 — In the EMPLOYEE table (1NF), if Ram changes his phone number, how many rows must be updated?
1. Arrange the normal forms in the correct order:
2. A relation is in 2NF if it is in 1NF and all non-key attributes are fully functionally dependent on the _____.
3. Arrange the dependency chain in the EMPLOYEE_DETAIL example:
4. Which normal form requires that every non-key attribute depends on "the whole key and nothing but the key"?
5. Match each normal form to what it removes:
6. Why is the EMPLOYEE table in Part 1 not in 1NF?
7. In the TEACHER table, what type of dependency does TEACHER_AGE on TEACHER_ID represent?
8. After normalizing the EMPLOYEE table from 1NF to remove redundancy, what should be the primary key of the TEACHER_SUBJECT table?
9. Which of the following is TRUE about transitive dependency?
10. In the EMPLOYEE_DETAIL table, which columns form the transitive chain?