Study and Productivity

Database Normalization Explained: Functional Dependencies, Keys and 1NF to BCNF

Understand functional dependencies, find candidate keys with attribute closure, decide the normal form and decompose a table into 3NF and BCNF.

Saizul Amin
Saizul Amin3 Nov 2026 · 3 min read
Database Normalization Explained: Functional Dependencies, Keys and 1NF to BCNF

Database Normalization Explained: Functional Dependencies, Keys and 1NF to BCNF

A badly designed table stores the same fact many times. Change it in one row and forget another, and the database contradicts itself. Normalization is the method for splitting tables so that each fact lives in one place. It rests on one idea, the functional dependency. This guide explains the steps that database courses examine, with the free database normalization helper to check closures, keys and decompositions.

Functional dependencies

A functional dependency X → Y means: whenever two rows agree on X, they must agree on Y. In a course-enrolment table:

  • StudentID → StudentName
  • CourseID → CourseTitle
  • StudentID, CourseID → Grade

Dependencies come from the meaning of the data (business rules), not from looking at a few sample rows.

Attribute closure

The closure X⁺ is every attribute that X determines. Start with X and keep applying dependencies whose left side is already in your set.

For {StudentID}: add StudentName. Nothing else applies, so {StudentID}⁺ = {StudentID, StudentName}.

For {StudentID, CourseID}: add StudentName, CourseTitle and Grade. That is every attribute, so {StudentID, CourseID} is a superkey.

Candidate keys

A candidate key is a minimal superkey: remove any attribute and it stops determining everything. A useful shortcut: an attribute that never appears on the right side of any dependency must be in every key. Here StudentID and CourseID never appear on the right, so every key contains both, and {StudentID, CourseID} is the only key.

Prime attributes are those in at least one candidate key.

The normal forms

1NF: every value is atomic (no lists inside a cell) and there are no repeating groups.

2NF: no non-prime attribute depends on only part of a candidate key. Our table fails: StudentName depends only on StudentID, part of the key. This causes anomalies: a student's name is repeated for every course they take.

3NF: for every dependency X → A, either X is a superkey or A is prime. This removes transitive dependencies. Example: Employee(EmpID, EmpName, DeptID, DeptName) with EmpID → DeptID and DeptID → DeptName. DeptName depends on the key only through DeptID, so the table is in 2NF but not 3NF.

BCNF: for every dependency X → A, X is a superkey. It is stricter than 3NF. The classic case that is in 3NF but not BCNF: (Student, Subject, Lecturer) where each lecturer teaches one subject (Lecturer → Subject) and a student has one lecturer per subject. Lecturer is not a superkey, but Subject is prime, so 3NF holds and BCNF fails.

Decomposing

3NF synthesis (always possible, keeps every dependency):

  1. Find a minimal cover of the dependencies.
  2. Make one table for each left side with all its right sides.
  3. If no table contains a candidate key, add one.

For the enrolment example: Students(StudentID, StudentName), Courses(CourseID, CourseTitle), Grades(StudentID, CourseID, Grade).

BCNF decomposition (always lossless, may lose a dependency): take a dependency X → Y that violates BCNF, split the table into X⁺ and X plus the remaining attributes, and repeat on each part. For the lecturer example you get (Lecturer, Subject) and (Student, Lecturer); the rule "one lecturer per student per subject" can no longer be checked within one table. That trade-off is why some designs stop at 3NF.

Using the helper

Type the attributes (names separated by commas, or single letters like ABCDE) and one dependency per line. The analysis tab shows all candidate keys, the prime attributes, the highest normal form and the dependencies that break each form. The decompose tab gives the 3NF synthesis and the BCNF splits, and the closure tab computes X⁺ for any set with each step listed.

Limits

The helper works from the dependencies you supply; it cannot infer them from data. Higher normal forms such as 4NF (multivalued dependencies) and practical concerns like query performance are outside its scope.

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages