Normalization
Normalization is the process of organizing data in a database to reduce redundancy (repeated data) and
ensure data integrity (accuracy and consistency).
Normal Forms (1NF, 2NF, 3NF)
1. First Normal Form (1NF)
Rule: A table is in 1NF if:
1. Each cell has only one value (atomic values).
2. Each row is unique.
Example of 1NF:
Imagine a table of students and their favorite subjects:
StudentID Name Subjects
1 Sambriddhi Singh Math, Science
2 Agastya Singh Math, Science, English
Problem: The "Subjects" column has multiple subjects in one cell, which violates the 1NF rule.
Solution: Make sure each cell contains only one value:
Table in 1NF:
StudentID StudentName Subject
1 Sambriddhi Singh Math
1 Sambriddhi Singh English
1 Sambriddhi Singh Science
2 Agastya Singh English
2 Agastya Singh History
Now, the table is in 1NF because each cell has only one value, and there are no repeating groups.
2. Second Normal Form (2NF)
Rule: A table is in 1NF if:
1. It is already in 2NF.
2. There is no partial dependency — every non-key column must depend on the entire primary key,
not just a part of it.
Example:
Let us consider table given below:
StudentID Subject TeacherID TeacherName
1 Math 1 Mr. Ravi Singh
1 Science 1 Mr. Ravi Singh
2 Math 1 Mr. Ravi Singh
2 English 2 Ms. Asha Thapa
Here, the TeacherName is dependent on TeacherID, but TeacherID is not the primary key of the table (it
is a composite key made of StudentID + Subject). This creates a partial dependency.
Corrected Tables in 2NF:
1. Student-Subject Table:
StudentID Subject TeacherID
1 Math 1
1 Science 1
2 Math 1
2 English 2
2. Teacher table:
TeacherID TeacherName
1 Mr. Ravi Singh
2 Ms. Asha Thapa
3NF (Third Normal Form)
3NF removes transitive dependencies. A table is in 3NF if it is in 2NF, and no non-key attribute depends
on another non-key attribute.
Rules:
No transitive dependencies (i.e., non-key attributes should not depend on other non-key attributes).
Example: If we add a column TeacherPhone to the Student-Subject table:
StudentID Subject TeacherID TeacherName TeacherPhone
1 Math 1 Mr. Ravi Singh 9851125045
1 Science 1 Mr. Ravi Singh 9851125045
2 Math 1 Mr. Ravi Singh 98511250450
2 English 2 Ms. Asha Thapa 9802015167
Here, TeacherPhone is dependent on TeacherName, not directly on TeacherID (the key). This is a
transitive dependency.
Corrected Tables in 3NF:
1. Student-Subject Table:
StudentID Subject TeacherID
1 Math 1
1 Science 1
2 Math 1
2 English 2
2. Teacher Table:
TeacherID TeacherName TeacherPhone
1 Mr. Ravi Singh 9851125045
2 Ms. Asha Thapa 9802015167
Advantages of Normalization
• Reduced data redundancy: Normalization helps to eliminate duplicate data in tables, reducing the
amount of storage space needed and improving database efficiency.
• Improved data consistency: Normalization ensures that data is stored in a consistent and
organized manner, reducing the risk of data inconsistencies and errors.
• Simplified database design: Normalization provides guidelines for organizing tables and data
relationships, making it easier to design and maintain a database.
• Improved query performance: Normalized tables are typically easier to search and retrieve data
from, resulting in faster query performance.
• Easier database maintenance: Normalization reduces the complexity of a database by breaking it
down into smaller, more manageable tables, making it easier to add, modify, and delete data.