Database Normalization: From 1NF to 3NF Explained
Database normalization is the process of organizing data in a database to reduce redundancy and improve data integrity. It involves applying a series of rules called normal forms.
- First Normal Form (1NF)
Goal: Eliminate repeating groups or arrays.
Rules:
Each column must contain atomic (indivisible) values.
Each record must be unique.
Example:
A table with multiple phone numbers in one column violates 1NF. You split those phone numbers into separate rows or columns.
- Second Normal Form (2NF)
Goal: Remove partial dependency.
Applies to: Tables with composite primary keys.
Rules:
Must be in 1NF.
All non-key attributes must depend on the entire primary key, not just part of it.
Example:
If a table has a composite key (e.g., StudentID + CourseID), and a column depends only on StudentID, move that column to another table.
- Third Normal Form (3NF)
Goal: Remove transitive dependency.
Rules:
Must be in 2NF.
Non-key attributes should not depend on other non-key attributes.
Example:
If a table has columns StudentID, AdvisorName, and AdvisorPhone, where AdvisorPhone depends on AdvisorName (not the key), separate the advisor information into another table.
Summary Table:
Normal Form Requirement Goal
1NF Atomic values, unique rows Eliminate repeating groups
2NF No partial dependency on composite keys Remove partial dependency
3NF No transitive dependency Remove transitive dependency
Why Normalize?
Avoid data redundancy
Prevent update anomalies
Ensure data integrity and easier maintenance
Top comments (0)