Normalization in Databases

0
Normalization: 1NF, 2NF, and 3NF Database Normalization

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:

StudentIDNameSubjects
1AliceMath, Science
2BobMath, English

Converted to 1NF:

StudentIDNameSubject
1AliceMath
1AliceScience
2BobMath
2BobEnglish

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:

StudentIDCourseIDStudentNameCourseName
1101AliceMath
1102AliceScience

Converted to 2NF:

Student Table:

StudentIDStudentName
1Alice

Course Table:

CourseIDCourseName
101Math
102Science

Enrollment Table:

StudentIDCourseID
1101
1102

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:

StudentIDCourseIDCourseNameInstructor
1101MathDr. Smith
1102ScienceDr. Adams

Converted to 3NF:

Course Table:

CourseIDCourseNameInstructor
101MathDr. Smith
102ScienceDr. Adams

Student Table:

StudentIDStudentName
1Alice

Enrollment Table:

StudentIDCourseID
1101
1102

Post a Comment

0Comments

Thanks for your feedback

Post a Comment (0)