Boyce-Codd Normal Form (BCNF) & Higher Normal Forms
Push beyond 3NF into BCNF and understand when 4NF/5NF matter.
In plain words
Every fact in a table should be decided by something that identifies a whole row. If something smaller decides a fact, split that fact into its own table.
Think of it like…
Club rules: "every rule must be decided by the membership card number" (BCNF). A rule like "each coach teaches only one sport", decided by the coach rather than by the membership, breaks it, even if it sounds harmless.
Where you’ve seen it
class_bookings(student, subject, teacher): each teacher teaches one subject (teacher → subject), and each student has one teacher per subject. The table is in 3NF but not BCNF, because teacher isn't a key yet determines subject. Splitting into teacher_subjects(teacher, subject) and student_teachers(student, teacher) fixes it.
Words you’ll hear
- Functional dependency
- X → Y: rows with the same X always have the same Y.
- Superkey / candidate key
- Columns that identify rows uniquely / a minimal such set.
- BCNF
- Every determinant of a non-trivial dependency is a superkey.
- Multi-valued dependency (4NF)
- Two independent lists of facts about one key stored in one table.
Visual diagram
Theory & example queries
How BCNF differs from 3NF
3NF says every non-key attribute depends on the key and nothing else, but it permits a dependency X → Y where Y is a prime attribute (part of some candidate key) even if X isn't a key. BCNF closes that gap: if any set of columns determines another column, it must be a superkey.
The difference only shows up when a table has overlapping candidate keys, as in class_bookings above. There, teacher → subject causes the familiar anomalies: a teacher's subject is repeated for each student, and changing it means updating many rows. The BCNF fix is to put teacher → subject in its own table.
CREATE TABLE teacher_subjects ( teacher text PRIMARY KEY, subject text NOT NULL);CREATE TABLE student_teachers ( student text, teacher text REFERENCES teacher_subjects (teacher), PRIMARY KEY (student, teacher));PostgreSQL is the lesson baseline unless noted otherwise.
Identify the table or database object the statement will modify.
Expected output
Note: Representative PostgreSQL-style command statuses; both statements succeed when their referenced name space and constraints are valid.
Key takeaway: BCNF: every determinant is a superkey; it differs from 3NF only with overlapping keys.
The trade-off, and 4NF / 5NF
A BCNF decomposition is always lossless (joining the parts gives back the original rows), but it isn't always dependency-preserving. After the split above, the rule "a student has one teacher per subject" spans two tables, so no single key enforces it; you'd need a trigger or application check. That's why designers sometimes stop at 3NF deliberately.
4NF handles multi-valued dependencies: employee_skills_languages(employee, skill, language) stores every combination of an employee's independent skills and languages, so adding one language means adding a row per skill. Split it into employee_skills and employee_languages. 5NF addresses join dependencies, which are rare in practice; most production schemas aim for 3NF or BCNF.
Instead of employee_skills_languages(employee, skill, language) with 3 skills × 2 languages = 6 rows, store employee_skills(employee, skill) (3 rows) and employee_languages(employee, language) (2 rows).
How it works, step by step
Follow one practical SQL workflow from start to finish. Select any step or play through the flow.
List the dependencies
Write down every functional dependency the business rules imply, such as teacher → subject.
(student, subject) → teacher · teacher → subject
When to use it & trade-offs
What it is
Boyce-Codd Normal Form (BCNF) tightens 3NF: for every functional dependency X → Y in a table, X must be a superkey (it must identify rows uniquely). 3NF allows one exception, when Y is part of some candidate key, and BCNF removes it. 4NF goes further, removing independent multi-valued facts stored in one table, and 5NF deals with rare join dependencies.
Why it matters: Most well-designed schemas in 3NF are already in BCNF, but the cases where they differ are classic exam and interview questions, and they show you understand dependencies rather than memorising rules. The 4NF example (skills and languages in one table) also appears in real schemas.
When to reach for it
- Database theory and normalisation questions
- Reviewing tables with several candidate keys
- Fixing tables that store every combination of independent lists
When to avoid or be careful
- Decomposing for BCNF without checking which rules can no longer be enforced
- Storing independent lists in one table (skills × languages)
- Chasing 5NF in everyday application design
3NF vs BCNF vs 4NF
Strengths: Removes most redundancy; always dependency-preserving.
Watch out: Allows rare anomalies with overlapping candidate keys.
Strengths: Removes all redundancy from functional dependencies.
Watch out: May split a rule across tables so no key enforces it.
Strengths: Stops combinatorial row explosion.
Watch out: More tables; rarely needed if the ERD is clean.
Interview signals & numbers to know
When this topic comes up
- “What's the difference between 3NF and BCNF?”
- “Is this table in BCNF?”
- Overlapping candidate keys
- Multi-valued dependencies
- Normalisation theory
Benchmarks & rules of thumb
- BCNF
- every determinant is a superkey
- 3 × 2 = 6
- rows for 3 skills and 2 languages in a non-4NF table
- 3NF / BCNF
- typical production targets
Common mistakes & follow-ups
Common interview mistakes
- Saying any table in 3NF is automatically in BCNF.
- Splitting for BCNF and silently losing the rule that a student has one teacher per subject.
- Combining employees' skills and languages in one table and multiplying rows.
Likely interviewer follow-ups
- Give an example of a table that's in 3NF but not BCNF.
- Is a BCNF decomposition always dependency-preserving?
- What problem does 4NF solve?
Knowledge check
Put it into practice
Practice related interview Q&A
Apply Boyce-Codd Normal Form (BCNF) & Higher Normal Forms with hands-on SQL practice and interview Q&A.