DBMS slides 📂 Functional Dependencies & Normalization · 7 of 9 43 min read

BCNF in DBMS: 3NF vs BCNF Explained Simply

Boyce–Codd Normal Form closes the loophole 3NF leaves open. A table can pass every 3NF test and still be redundant when a non-key determinant points to a prime attribute. This tutorial uses the Music Academy example to show the flaw, defines BCNF ("every determinant must be a superkey"), walks through the decomposition, and explains BCNF's own trade-off: always lossless, but not always dependency-preserving.

BCNF — Closing 3NF's Loophole

A table can pass every 3NF test and still be redundant. Boyce–Codd Normal Form seals the crack with one strict rule: every determinant must be a superkey — no exceptions for prime attributes.
Determinant = Superkey Overlapping Keys The Trade-Off Decompose

Press Next → or use ← → arrow keys

Section 01

The Story — The Music Academy Mix-Up

One instructor, one instrument — repeated 50 times
A music academy logs every lesson: student, instrument, instructor. The rule is simple — each instructor teaches exactly one instrument (Mr. Lee always teaches Guitar). But "Lee → Guitar" is copied onto every row Lee appears in. Retrain Lee to Ukulele and all 50 rows need editing; a new instructor can't be recorded until a student enrolls; and if Lee's last student quits, the fact vanishes.
🕳️
The Twist

This table is already in Third Normal Form — it passes every 3NF test. Yet the redundancy and all three anomalies are right there. The loophole is a blind spot only BCNF closes.

Section 02

Foundation — Keys, Fast

BCNF turns on one question: is the left side of each dependency actually a key? So the vocabulary of "keys" matters.

🗝️
Superkey
Any set of attributes that uniquely identifies a row (may include extras).
🔑
Candidate key
A minimal superkey — nothing can be dropped and still identify the row.
🟢
Prime attribute
Belongs to some candidate key.
⚪
Non-prime attribute
Belongs to no candidate key.
➡️
Functional Dependency, Recalled

X → Y means "X determines Y" — fix X, and Y is fixed too. The whole BCNF question is whether that determinant X is a key.

Section 03

3NF, in One Breath — and Its Crack

📘
The 3NF Test

A table is in 3NF if it's in 2NF and, for every non-trivial X → Y, at least one holds: (A) X is a superkey, or (B) Y is a prime attribute.

X is a superkeyCondition A OR Y is primeCondition B — the loophole
🧨
That Little Word "OR"

The "or" is the crack in the wall. 3NF will happily accept a dependency whose left side is not a key — as long as the right side happens to be a prime attribute. That's exactly how redundancy sneaks past.

Section 04

The Prime-Attribute Loophole, In Data

LESSON — passes 3NF, still broken
StudentInstrumentInstructor
AaravGuitarMr. Lee
DiyaGuitarMr. Lee
KabirPianoMs. Roy
MiraGuitarMr. Lee
AaravPianoMs. Roy
📋
Business Rules → FDs

1. Each instructor teaches one instrument → Instructor → Instrument
2. A student learns an instrument from one instructor → {Student, Instrument} → Instructor

🔑
Two Overlapping Candidate Keys

{Student, Instrument} and {Student, Instructor}. So Student, Instrument, Instructor are all prime — every attribute is in some key.

🔎
3NF Test on Instructor → Instrument

Condition A fails — Instructor alone is not a superkey (Lee has many students). Condition B passes — Instrument is prime. So 3NF says "allowed" ✓ … and the redundancy stays.

Section 04 · Cost

In 3NF — and Still Broken

➕
Insertion anomaly
Ms. Singh teaches Violin — but she can't be recorded until some student enrolls with her.
✏️
Update anomaly
Lee switches to Ukulele — every Lee row must be edited. Miss one and the data contradicts itself.
🗑️
Deletion anomaly
Delete Lee's last student and the fact "Lee teaches Guitar" is erased entirely.
🎯
The Diagnosis

The culprit is Instructor → Instrument: a real dependency whose left side isn't a key. 3NF let it through because Instrument is prime. To remove the redundancy, we need a rule that doesn't care whether the right side is prime.

Section 05

Boyce–Codd Normal Form — The Definition

🔒
The BCNF Rule

For every non-trivial FD X → Y, the left-hand side must be a superkey. No exceptions for prime attributes. In one phrase: "every determinant is a key."

📗
3NF says
X is a superkey OR Y is prime.
📘
BCNF says
X is a superkey — full stop.
🪜
Where It Sits

Every BCNF table is automatically in 3NF, but not every 3NF table is in BCNF. The gap between them is precisely the set of tables with overlapping candidate keys — sometimes nicknamed "3.5NF."

Section 06

The Loophole vs the Lockdown

Same dependency, same data — two rulebooks, two verdicts.

InstructorNOT a superkey Instrumentprime attribute 📗 3NF rulebook"Y is prime? → Allowed."✓ ACCEPTS 📘 BCNF rulebook"X not a superkey? → Rejected."✗ BLOCKS
🛡️
The Block Is the Point

3NF trusts the prime attribute and lets the dependency through; BCNF trusts only keys and rejects it. That rejection is exactly what forces the split that removes the redundancy.

Section 07

Decomposing LESSON to BCNF

The fix is mechanical: for the violating FD Instructor → Instrument, make a table keyed on Instructor, and drop Instrument from the rest.

LESSON3NF · redundant TEACHESInstructor (PK) · Instrument STUDIESStudent · Instructor join on Instructor
TEACHES · Instructor → Instrument
Instructor PKInstrument
LeeGuitar
RoyPiano
SinghViolin

Singh–Violin now stored with no students.

STUDIES · student ↔ instructor
StudentInstructor
AaravLee
DiyaLee
KabirRoy
MiraLee

"Lee → Guitar" now lives in exactly one place.

Section 08

The Catch — BCNF's Own Trade-Off

✅
Kept (preserved)
Instructor → Instrument lives wholly inside TEACHES — still enforced by that table's key.
⚠️
Lost (not preserved)
{Student, Instrument} → Instructor now spans both tables — no single key can enforce it.
🧩
Lossless, But Not Dependency-Preserving

A BCNF decomposition is always lossless (rejoin the tables and you rebuild the original), but it is not always dependency-preserving. The rule "a student takes an instrument from only one instructor" can no longer be guaranteed by one table's key — you need a join, a view, or application logic.

⚖️
The Classic Dilemma

3NF is always both lossless and dependency-preserving — but may keep some redundancy. BCNF removes that redundancy — but may sacrifice dependency preservation. You choose which property matters more.

Section 09

3NF vs BCNF — Side by Side

Aspect3NFBCNF
Rule for X → YX is superkey OR Y is primeX must be a superkey
Prime-attribute loopholeAllowedClosed
StrictnessWeakerStricter (3.5NF)
Lossless decompositionAlwaysAlways
Dependency-preservingAlways achievableNot always possible
Residual redundancyPossible (overlapping keys)Essentially none from FDs
When they differOverlapping candidate keys with a non-key determinant
🧠
The Mental Model

3NF trusts prime attributes; BCNF trusts only keys. If your table has a single candidate key — as most do — reaching 3NF already puts you in BCNF for free.

Section 10

Academic vs Industry Lenses

🎓
Academic lens
Defined by Boyce & Codd (1974): every determinant must be a superkey. Decomposition is always lossless but not guaranteed dependency-preserving — a theoretical limit. Hierarchy: 1NF ⊂ 2NF ⊂ 3NF ⊂ BCNF.
🏭
Industry lens
3NF is the everyday default; true BCNF violations are rare (only overlapping candidate keys). Engineers weigh BCNF against lost constraints — re-enforced by triggers, views, or the app layer. Design to 3NF, push to BCNF only when real anomalies appear.
🤝
Where They Meet

Academia proves why BCNF is the tightest FD-based form; industry decides whether the trade is worth it for a given workload.

Section 11

Stop at 3NF, or Push to BCNF?

🟢
Single candidate key
One candidate key → 3NF already equals BCNF. Nothing more to do (most OLTP tables).
🟠
Overlapping keys + redundancy
Multiple overlapping keys with a non-key determinant causing real anomalies → push to BCNF.
🔴
Constraint would be lost
If BCNF breaks a dependency you can't cheaply re-enforce → stay at 3NF and document it.
🔭
Beyond BCNF

BCNF closes redundancy from functional dependencies. Repetition from independent multi-valued facts is a 4NF problem; redundancy from join dependencies is 5NF. BCNF is the end of the functional-dependency road.

Practice · Setup

Test Yourself — The Cooking School

RECIPE_CLASS — who learns what, from whom
StudentDishChef
NinaPastaMarco
OmarPastaMarco
PriyaSushiAki
NinaSushiAki
RaviPastaMarco
📋
The Business Rules → FDs

1. Each chef cooks one dish → Chef → Dish
2. Per dish, a student has one chef → {Student, Dish} → Chef

🎯 YOUR TURN — PAUSE & SOLVE
1
Find all the candidate keys.
2
Which attributes are prime vs non-prime?
3
Run the 3NF test on Chef → Dish.
4
Run the BCNF test on Chef → Dish.
5
If it fails, decompose — and spot the lost constraint.
👀
Gut Check First

"Marco → Pasta" is already written three times. Your gut says broken — the exercise is proving whether the rules agree.

Practice · Steps 1–2

Find the Keys — They Overlap

Candidate key 1 {Student, Dish} Candidate key 2 {Student, Chef} Dish Student Chef shared → the overlap 🚩
🔑
Two Candidate Keys

{Student, Dish} (rule 2 gives Chef) and {Student, Chef} (rule 1 gives Dish). They overlap on Student — the early warning sign.

🟢
Every Attribute Is Prime

Student, Dish, and Chef each sit in some candidate key. So there are no non-prime attributes at all.

Practice · Steps 3–5

3NF Passes, BCNF Fails → Decompose

📗
3NF test · Chef → Dish

Chef a superkey? No. Dish prime? Yes → one holds, so passes 3NF ✓ (redundancy survives).

📘
BCNF test · Chef → Dish

Chef a superkey? No. No "or" clause → fails BCNF ❌ — decompose on this FD.

CHEF_SPECIALTY · Chef → Dish
Chef PKDish
MarcoPasta
AkiSushi
CLASS · student ↔ chef
StudentChef
NinaMarco
OmarMarco
PriyaAki
NinaAki
RaviMarco
✅
"Marco → Pasta" — once

Redundancy gone; both tables in BCNF.

⚠️
Lost constraint

{Student, Dish} → Chef now spans both tables — needs a join. Lossless ✓, dependency-preserving ✗.

Practice · Contrast

Two Keys, Yet Already in BCNF

Don't over-apply the rule: multiple candidate keys alone don't break BCNF. They must overlap and hide a non-key determinant.

EMPLOYEE · emails are unique
EmpIDEmailName
E1nina@coNina
E2omar@coOmar
🔗
The FDs

EmpID → Email, Name and Email → EmpID, Name

🔑
Two NON-overlapping keys

{EmpID} and {Email} — different single columns, no shared attribute.

✅
Already BCNF

Every determinant (EmpID, Email) is a superkey on its own → nothing to fix.

🔬
The Fingerprint to Look For

A 3NF-but-not-BCNF table needs overlapping candidate keys plus a determinant that isn't a key. No overlap → 3NF already equals BCNF.

Section 12

Golden Rules of BCNF

🏆 NON-NEGOTIABLE PRINCIPLES
1
Reach 3NF first. BCNF tightens 3NF — it never replaces the ladder below.
2
List every determinant and ask: is X a superkey? If not, BCNF breaks.
3
Suspect overlapping candidate keys — that's the one place 3NF fails BCNF.
4
Decompose by the violating FD: create table (X, Y) with X as key, remove Y from the original. Always lossless.
5
Check dependency preservation before committing — re-enforce a lost constraint via a view, trigger, or app logic.
6
Mantra: "Every determinant is a key — the key, the whole key, and nothing but the key, with no prime-attribute exceptions."
FINAL

Every Determinant Is a Key

3NF+Prerequisite
1Rule: X = superkey
100%Lossless
≈0FD redundancy left
🎯
The Tightest Form the FDs Can Buy

BCNF closes 3NF's prime-attribute loophole by demanding that every determinant be a superkey. The Music Academy split into TEACHES + STUDIES removed the last FD-driven redundancy — at the cost of one dependency that now needs a join to enforce. Lossless always; dependency-preserving not always. That single trade is the whole story of BCNF.

🧠
One Sentence to Remember

3NF says "superkey or prime"; BCNF says "superkey — full stop." When a table has a single candidate key, the two are the same thing.

🔒 End of tutorial · Press ← to review, or click Restart