Example: Consider a table with student information:
StudentID Courses
1 Math, Physics, Chem
2 English, History
This table is not in 1NF because the "Courses" column contains a list of values.
To convert it to 1NF:
StudentID Course
1 Math
1 Physics
1 Chem
2 English
2 History
2. Second Normal Form (2NF):
Definition:
A table is in 2NF if it is in 1NF and all non-key attributes are fully functionally
dependent on the primary key.
Requirements:
It must be in 1NF.
All non-key attributes must be fully functionally dependent on the primary key.
Example: Consider a table with information about courses and instructors:
CourseID Instructor InstructorEmail
1 Dr. Smith
[email protected] 2 Dr. Brown
[email protected] 3 Dr. Smith
[email protected]This table is not in 2NF because the "InstructorEmail" attribute is dependent on the
instructor, which is part of the composite primary key.
To convert it to 2NF:
CourseID Instructor
1 Dr. Smith
2 Dr. Brown
3 Dr. Smith
Instructor InstructorEmail
Dr. Smith [email protected]
Dr. Brown [email protected]
3. Third Normal Form (3NF):
Definition:
A table is in 3NF if it is in 2NF, and there are no transitive dependencies: no non-
prime attribute is transitively dependent on any super key.
Requirements:
It must be in 2NF.
Eliminate transitive dependencies.
Example: Consider a table with information about students, courses, and instructors:
StudentID StudentName Instructor InstructorEmail
1 Alice Dr. Smith
[email protected] 2 Bob Dr. Brown
[email protected]This table is not in 3NF because "InstructorEmail" is transitively dependent on the primary
key (StudentID).
To convert it to 3NF:
InstructorID
StudentID Instructor
StudentName InstructorEmail
InstructorID
11 Dr. Smith
Alice [email protected]
1
22 Dr. Brown
Bob [email protected]
2
In this transformed structure, "InstructorEmail" is no longer transitively dependent on the
primary key, and the table is in 3NF.