2. Normalization
Description
Normalization is a database design technique that organizes tables to reduce redundancy and dependency of data. It divides larger tables into smaller ones and links them using relationships. Its purpose is to eliminate redundant (useless) data and ensure data is stored logically.
Benefits of Normalization
- Improved data integrity (no redundant data)
- Smaller databases
- Better performance
- Fewer indexes
- Less management
- Prevents data modification anomalies (insert, update, delete)
Hierarchy of Normal Forms
1NF is the weakest, 2NF is stronger than 1NF, 3NF is stronger than 2NF, and BCNF is the strongest. Every relation in BCNF is in 3NF; every relation in 3NF is in 2NF; every relation in 2NF is in 1NF.
Running Example
A learner table where one person holds several certifications:
| Name | Birth_date | Certifications | Cert 1 | Cert 2 | Cert 3 |
|---|---|---|---|---|---|
| John | 1990/02/12 | PBI, MCSA, MTA | PBI | MCSA | MTA |
| Kelly | 1988/10/01 | Excel | Excel | NULL | NULL |
| Bryan | 1991/01/15 | PBI, Excel | PBI | Excel | NULL |
| Rob | 1986/08/07 | PBI | PBI | NULL | NULL |
Steps
Step 1: First Normal Form (1NF)
A relation is in 1NF if all values are single-valued and atomic. Remove repeating groups and repeating columns, and add a primary key.
Result: one row per learner–certification pair (key = Learner_ID + Certification_ID).
| Learner_ID | Name | Birth_date | Certification_ID | Certification_name | Vendor_name | Date_acquired |
|---|---|---|---|---|---|---|
| 1 | John | 1990/02/12 | 1 | PBI | Microsoft | 2017/01/08 |
| 1 | John | 1990/02/12 | 2 | MCSA | Microsoft | 2020/04/16 |
| 1 | John | 1990/02/12 | 3 | MTA | Microsoft | 2021/05/12 |
| 2 | Kelly | 1988/10/01 | 4 | Excel | Microsoft | 2018/06/03 |
| 3 | Bryan | 1991/01/15 | 1 | PBI | Microsoft | 2019/12/11 |
| 3 | Bryan | 1991/01/15 | 4 | Excel | Microsoft | 2020/04/07 |
| 4 | Rob | 1986/08/07 | 1 | PBI | Microsoft | 2022/01/15 |
An outer join reproduces the original information without loss.
Step 2: Second Normal Form (2NF)
- The relation is in 1NF, and
- every non-key attribute is fully functionally dependent on the whole primary key (no partial dependencies).
- Create separate tables for sets of values that apply to multiple records and relate them with a foreign key.
- If the primary key is a single column, the table is already in 2NF.
Result: three tables.
- Learner(Learner_ID, Name, Birth_date)
- Certification(Certification_ID, Certification_name, Vendor_name)
- Learner_Certification(Learner_ID, Certification_ID, Date_acquired)
Step 3: Third Normal Form (3NF)
- The relation satisfies 2NF, and
- it has no transitive dependencies (a non-key attribute depending on another non-key attribute).
Here Vendor_name depends on the vendor, not on the certification, so it is moved to its own table:
- Vendor(Vendor_ID, Vendor_name)
- Certification(Certification_ID, Certification_name, Vendor_ID)
Final 3NF schema: Learner, Certification, Vendor, Learner_Certification.
Step 4: Boyce-Codd Normal Form (BCNF)
The strongest of the four forms: every determinant (an attribute that determines others) must be a candidate key. Any relation in BCNF is also in 3NF.
Summary Table
| Normal Form | Requirement |
|---|---|
| 1NF | Atomic values, no repeating groups, has a primary key |
| 2NF | 1NF + no partial dependency on part of a composite key |
| 3NF | 2NF + no transitive dependency among non-key attributes |
| BCNF | Every determinant is a candidate key |
Conclusion
Normalization removes redundancy and anomalies by decomposing tables without losing information; related tables are reconnected using primary and foreign keys.
All rights remain with the original author (Algo-holics). Publishing here does not grant a license to copy or reuse this text. Copyright & license. If you noticed a mistake or copyright issues, please contact: lebroskiofficial@proton.me