1NF (First Normal Form)
Definition: A table is in 1NF if it contains only atomic values, with each column having a single value per row. No repeating groups or arrays are allowed in any column.
Example:
Initial Table:
StudentID | Name | Subjects |
---|---|---|
1 | Alice | Math, Science |
2 | Bob | Math, English |
Converted to 1NF:
StudentID | Name | Subject |
---|---|---|
1 | Alice | Math |
1 | Alice | Science |
2 | Bob | Math |
2 | Bob | English |
2NF (Second Normal Form)
Definition: A table is in 2NF if it is already in 1NF, and all non-key attributes are fully dependent on the entire primary key (no partial dependency).
Example:
Initial Table:
StudentID | CourseID | StudentName | CourseName |
---|---|---|---|
1 | 101 | Alice | Math |
1 | 102 | Alice | Science |
Converted to 2NF:
Student Table:
StudentID | StudentName |
---|---|
1 | Alice |
Course Table:
CourseID | CourseName |
---|---|
101 | Math |
102 | Science |
Enrollment Table:
StudentID | CourseID |
---|---|
1 | 101 |
1 | 102 |
3NF (Third Normal Form)
Definition: A table is in 3NF if it is already in 2NF, and all non-key attributes are only dependent on the primary key (no transitive dependencies).
Example:
Initial Table:
StudentID | CourseID | CourseName | Instructor |
---|---|---|---|
1 | 101 | Math | Dr. Smith |
1 | 102 | Science | Dr. Adams |
Converted to 3NF:
Course Table:
CourseID | CourseName | Instructor |
---|---|---|
101 | Math | Dr. Smith |
102 | Science | Dr. Adams |
Student Table:
StudentID | StudentName |
---|---|
1 | Alice |
Enrollment Table:
StudentID | CourseID |
---|---|
1 | 101 |
1 | 102 |
Thanks for your feedback