1NF
1NF
Issue:
Convert to 1NF
Issue:
Name and Phone Number depend only on Student_ID (not the full
primary key (Student_ID, Course)).
Instructor depends on Course, not on (Student_ID, Course).
Convert to 2NF
Course Instructor
Math Prof. X
Science Prof. Y
Student_ID Course
101 Math
101 Science
102 Science
This violates 3NF, where all non-key attributes must depend only on the
primary key.
To fix this issue, we separate the city information into a new table based on
Zip Code.
✅ Table 2: Zip Code Table (Separate table for City based on Zip Code)
1. All non-key attributes depend only on the primary key in each table:
o In the Student Table, Name, Phone Number, and Zip Code depend
only on Student_ID.
o In the Zip Code Table, City depends only on Zip Code.
1. Avoids Redundancy
o If City remained in the Student Table, it would repeat multiple
times for every student from the same zip code.
o Now, we store City once per Zip Code.
2. Data Integrity
o If City names change (e.g., NYC becomes New York City), we
update it only once in the Zip Code Table, ensuring consistency.
If we want to get the full student details including the City, we JOIN both
tables:
Result:
Conclusion
Course Department
Math Science
Science Science
History Arts
Instructor Course
Prof. X Math
Prof. Y Science
Prof. Z History
Student_ID Course
101 Math
101 Science
Student_ID Hobby
101 Painting
101 Music
Project_ID Employee_ID
P1 E101
P1 E102
P2 E101
P2 E103
Employee_ID Skill
E101 Java
E102 Python
E103 C++