BCNF — Closing 3NF's Loophole
Press Next → or use ← → arrow keys
The Story — The Music Academy Mix-Up
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.
Foundation — Keys, Fast
BCNF turns on one question: is the left side of each dependency actually a key? So the vocabulary of "keys" matters.
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.
3NF, in One Breath — and Its Crack
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.
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.
The Prime-Attribute Loophole, In Data
| Student | Instrument | Instructor |
|---|---|---|
| Aarav | Guitar | Mr. Lee |
| Diya | Guitar | Mr. Lee |
| Kabir | Piano | Ms. Roy |
| Mira | Guitar | Mr. Lee |
| Aarav | Piano | Ms. Roy |
1. Each instructor teaches one instrument → Instructor → Instrument
2. A student learns an instrument from one instructor → {Student, Instrument} → Instructor
{Student, Instrument} and {Student, Instructor}. So Student, Instrument, Instructor are all prime — every attribute is in some key.
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.
In 3NF — and Still Broken
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.
Boyce–Codd Normal Form — The Definition
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."
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."
The Loophole vs the Lockdown
Same dependency, same data — two rulebooks, two verdicts.
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.
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.
| Instructor PK | Instrument |
|---|---|
| Lee | Guitar |
| Roy | Piano |
| Singh | Violin |
Singh–Violin now stored with no students.
| Student | Instructor |
|---|---|
| Aarav | Lee |
| Diya | Lee |
| Kabir | Roy |
| Mira | Lee |
"Lee → Guitar" now lives in exactly one place.
The Catch — BCNF's Own Trade-Off
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.
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.
3NF vs BCNF — Side by Side
| Aspect | 3NF | BCNF |
|---|---|---|
| Rule for X → Y | X is superkey OR Y is prime | X must be a superkey |
| Prime-attribute loophole | Allowed | Closed |
| Strictness | Weaker | Stricter (3.5NF) |
| Lossless decomposition | Always | Always |
| Dependency-preserving | Always achievable | Not always possible |
| Residual redundancy | Possible (overlapping keys) | Essentially none from FDs |
| When they differ | Overlapping candidate keys with a non-key determinant | |
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.
Academic vs Industry Lenses
Academia proves why BCNF is the tightest FD-based form; industry decides whether the trade is worth it for a given workload.
Stop at 3NF, or Push to 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.
Test Yourself — The Cooking School
| Student | Dish | Chef |
|---|---|---|
| Nina | Pasta | Marco |
| Omar | Pasta | Marco |
| Priya | Sushi | Aki |
| Nina | Sushi | Aki |
| Ravi | Pasta | Marco |
1. Each chef cooks one dish → Chef → Dish
2. Per dish, a student has one chef → {Student, Dish} → Chef
"Marco → Pasta" is already written three times. Your gut says broken — the exercise is proving whether the rules agree.
Find the Keys — They Overlap
{Student, Dish} (rule 2 gives Chef) and {Student, Chef} (rule 1 gives Dish). They overlap on Student — the early warning sign.
Student, Dish, and Chef each sit in some candidate key. So there are no non-prime attributes at all.
3NF Passes, BCNF Fails → Decompose
Chef a superkey? No. Dish prime? Yes → one holds, so passes 3NF ✓ (redundancy survives).
Chef a superkey? No. No "or" clause → fails BCNF ❌ — decompose on this FD.
| Chef PK | Dish |
|---|---|
| Marco | Pasta |
| Aki | Sushi |
| Student | Chef |
|---|---|
| Nina | Marco |
| Omar | Marco |
| Priya | Aki |
| Nina | Aki |
| Ravi | Marco |
Redundancy gone; both tables in BCNF.
{Student, Dish} → Chef now spans both tables — needs a join. Lossless ✓, dependency-preserving ✗.
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.
| EmpID | Name | |
|---|---|---|
| E1 | nina@co | Nina |
| E2 | omar@co | Omar |
EmpID → Email, Name and Email → EmpID, Name
{EmpID} and {Email} — different single columns, no shared attribute.
Every determinant (EmpID, Email) is a superkey on its own → nothing to fix.
A 3NF-but-not-BCNF table needs overlapping candidate keys plus a determinant that isn't a key. No overlap → 3NF already equals BCNF.
Golden Rules of BCNF
Every Determinant Is a Key
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.
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