Normalization in Database Management System
Introduction to Normalization in Database Management System
Normalization is a process in database management aimed at organizing data to reduce
redundancy and improve data integrity. It involves dividing large tables into smaller ones
and defining relationships between them to ensure that data is stored logically and
efficiently.
Example
Let's consider a simple example of a student database:
StudentID StudentName CourseID CourseName Instructor
1 Alice 101 Math Dr. Smith
2 Bob 102 Science Dr. Jones
1 Alice 103 History Dr. Brown
3 Charlie 101 Math Dr. Smith
Steps of Normalization
1. First Normal Form (1NF)
Rule: A table is in 1NF if:
- It contains only atomic (indivisible) values.
- Each record needs to be unique.
Example in 1NF:
StudentID StudentName CourseID CourseName Instructor
1 Alice 101 Math Dr. Smith
2 Bob 102 Science Dr. Jones
1 Alice 103 History Dr. Brown
3 Charlie 101 Math Dr. Smith
2. Second Normal Form (2NF)
Rule: A table is in 2NF if:
- It is in 1NF.
- All non-key attributes are fully functional dependent on the primary key.
Steps to achieve 2NF:
1. 1. Identify the primary key.
2. 2. Ensure that non-key attributes are fully dependent on the primary key.
Example:
Separate the table into two:
Students Table:
StudentID StudentName
1 Alice
2 Bob
3 Charlie
Courses Table:
CourseID CourseName Instructor
101 Math Dr. Smith
102 Science Dr. Jones
103 History Dr. Brown
Enrollment Table:
StudentID CourseID
1 101
2 102
1 103
3 101
3. Third Normal Form (3NF)
Rule: A table is in 3NF if:
- It is in 2NF.
- There are no transitive dependencies (i.e., non-key attributes are not dependent on
other non-key attributes).
Example:
Our tables from 2NF are already in 3NF as there are no transitive dependencies.
4. Boyce-Codd Normal Form (BCNF)
Rule: A table is in BCNF if:
- It is in 3NF.
- For every functional dependency (A → B), A should be a super key.
Example:
In our case, each functional dependency has the left side as a super key in their respective
tables, so they are also in BCNF.
Summary
- 1NF: Ensure the table has atomic columns and unique rows.
- 2NF: Ensure full functional dependency of non-key attributes on the primary key.
- 3NF: Remove transitive dependencies.
- BCNF: Ensure every determinant is a super key.
This process of normalization helps to reduce redundancy and improve data integrity,
making the database more efficient and easier to maintain.