Database Normalization: From UNF to 3NF
Unnormalized Table (UNF)
CourseId CourseName StudentId StudentName YearOfStudy Hours_Spent
C101 Database Management
S101System Williams 1 60
S201 Christina 2 30
S202 Michael 2 40
C102 Advanced DB S101 Williams 1 45
S301 Alex 3 60
First Normal Form (1NF)
- Eliminate repeating groups and ensure atomicity.
- Problems in 1NF:
* Redundancy
* Update/Insertion/Deletion anomalies
CourseId CourseName StudentId StudentName YearOfStudy Hours_Spent
C101 Database Management
S101System Williams 1 60
C101 Database Management
S201System Christina 2 30
C101 Database Management
S202System Michael 2 40
C102 Advanced DB S101 Williams 1 45
C102 Advanced DB S301 Alex 3 60
Second Normal Form (2NF)
- Must be in 1NF and have no partial dependencies.
- Decomposition based on functional dependencies:
FD1: CourseId -> CourseName
FD2: StudentId -> StudentName, YearOfStudy
FD3: (CourseId, StudentId) -> Hours_Spent
Course Table
Database Normalization: From UNF to 3NF
CourseId CourseName
C101 Database Management System
C102 Advanced DB
Student Table
StudentId StudentName YearOfStudy
S101 Williams 1
S201 Christina 2
S202 Michael 2
S301 Alex 3
Enrollment Table
CourseId StudentId Hours_Spent
C101 S101 60
C101 S201 30
C101 S202 40
C102 S101 45
C102 S301 60
Third Normal Form (3NF)
- Must be in 2NF and have no transitive dependencies.
- All non-prime attributes are fully functionally dependent on the primary key.
- Already satisfied in the current decomposition.
Functional Dependencies Summary
FD1: CourseId -> CourseName
FD2: StudentId -> StudentName, YearOfStudy
FD3: (CourseId, StudentId) -> Hours_Spent
Database Normalization: From UNF to 3NF
Summary of Problems Solved
Problem Type Encountered In Resolved In Explanation
Repeating groups UNF 1NF Flattened rows
Partial dependencies 1NF 2NF Decomposed into Course and Student
Transitive dependencies 2NF 3NF No indirect dependencies remain