Skip to content
Dev Dump

Normalization

Normalization is the process of organizing the data and the attributes of a database. It reduces redundancy and ensures that data is stored logically.

Normalization overview

A relation is in 1NF if it contains only atomic (indivisible) values, and each column contains values of a single type.

  • Conditions:
    • No repeating groups or arrays.
    • Each cell in the table must contain a single value.
    • The order in which data is stored does not matter.
Student_IDNameSubjects
1AliceMath, Science
2BobEnglish
Student_IDNameSubject
1AliceMath
1AliceScience
2BobEnglish

A relation is in 2NF if it is in 1NF and all non-prime attributes (attributes that are not part of any candidate key) are fully functionally dependent on the entire candidate key.

  • Conditions:
    • It must be in 1NF.
    • No partial dependency (i.e., non-prime attributes must depend on the whole primary key, not just part of it).
Student_IDCourseInstructorInstructor_Phone
1MathDr. Smith1234
1ScienceDr. Taylor5678
2MathDr. Smith1234

Student Table:

Student_IDCourse
1Math
1Science
2Math

Instructor Table:

CourseInstructorInstructor_Phone
MathDr. Smith1234
ScienceDr. Taylor5678

A relation is in 3NF if it is in 2NF and no transitive dependency exists (i.e., non-prime attributes should not depend on other non-prime attributes).

  • Conditions:
    • It must be in 2NF.
    • There is no transitive dependency (no non-prime attribute depends on another non-prime attribute).
Student_IDCourseInstructorInstructor_Email
1MathDr. Smithsmith@email.com
2MathDr. Smithsmith@email.com
3ScienceDr. Taylortaylor@email.com

Student Table:

Student_IDCourse
1Math
2Math
3Science

Instructor Table:

InstructorInstructor_Email
Dr. Smithsmith@email.com
Dr. Taylortaylor@email.com

A relation is in BCNF if it is in 3NF and for every functional dependency, the left-hand side (determinant) is a superkey.

  • Conditions:
    • It must be in 3NF.
    • Every determinant is a superkey.
Student_IDCourseInstructor
1MathDr. Smith
2MathDr. Smith
3ScienceDr. Taylor

Student Table:

Student_IDCourse
1Math
2Math
3Science

Instructor Table:

CourseInstructor
MathDr. Smith
ScienceDr. Taylor

A relation is in 4NF if it is in BCNF and has no multi-valued dependencies.

  • Conditions:
    • It must be in BCNF.
    • No multi-valued dependencies exist, where one attribute determines multiple independent values.
Student_IDHobbyLanguage
1ReadingEnglish
1PaintingFrench

Student Table:

Student_IDHobby
1Reading
1Painting

Language Table:

Student_IDLanguage
1English
1French

A relation is in 5NF if it is in 4NF and cannot be decomposed into smaller relations without loss of information (i.e., no join dependency exists).

  • Conditions:
    • It must be in 4NF.
    • The relation should not have any join dependencies that cause loss of information when decomposed.
Student_IDCourseInstructor
1MathDr. Smith
1ScienceDr. Taylor
2MathDr. Smith

Student Table:

Student_IDCourse
1Math
1Science
2Math

Instructor Table:

CourseInstructor
MathDr. Smith
ScienceDr. Taylor
Normal FormConditions
1NFAtomic values, no repeating groups
2NF1NF + No partial dependency
3NF2NF + No transitive dependency
BCNF3NF + Every determinant is a superkey
4NFBCNF + No multi-valued dependencies
5NF4NF + No join dependencies (lossless decomposition)