BCNF and Denormalization
Learn the stricter Boyce-Codd normal form, glimpse higher normal forms, and decide when deliberately denormalizing a design is worth the trade-offs.
Welcome back!
Step 1 of 12Learn
Boyce-Codd normal form
3NF handles almost every real table, but it has a loophole for unusual cases with overlapping candidate keys. Boyce-Codd normal form (BCNF) closes it with a simpler, stricter rule:
For every functional dependency A → B in the table, A must be a superkey (a set of columns that contains a candidate key).
Here's the classic example. A tutoring center records which tutor helps each student in each subject:
tutoring(student, subject, tutor)
The rules: each tutor teaches only one subject (tutor → subject), and for each subject, a student has one tutor ((student, subject) → tutor). Candidate keys are (student, subject) and (student, tutor). Every column is part of some key, so there are no non-prime columns, and 3NF is satisfied.
But tutor → subject has a determinant, tutor, that is not a superkey. The consequence is redundancy: if Dr. Kim teaches chemistry to 40 students, "Kim teaches chemistry" is stored 40 times. And you can't record that Kim teaches chemistry until she has a student.
The BCNF fix: tutor_subject(tutor, subject) and student_tutor(student, tutor). The price: the rule "a student has only one tutor per subject" now spans two tables and can't be enforced by a simple key. That trade-off is why designers sometimes stop at 3NF.
Step 2 of 12Practice · True or false
Every table in BCNF is also in 3NF, but not every table in 3NF is in BCNF.
Step 3 of 12Diagram
Where 3NF and BCNF overlap
Every BCNF table also satisfies 3NF, so nothing sits in BCNF alone. The 3NF-only zone is small and holds unusual tables with overlapping candidate keys.
Tap a shape with to see more.
- 3NF tables
- BCNF tables
- 3NF tables + BCNF tables (overlap)
With a single candidate key, 3NF and BCNF coincide.
- customer
- orders
- book
- most real tables
- 3NF tables only
Overlapping candidate keys let tutor → subject slip through 3NF.
- tutoring (student, subject, tutor)
Step 4 of 12Learn
Beyond BCNF
Higher normal forms exist, though you'll rarely need them by name.
Fourth normal form (4NF) deals with independent multivalued facts stored together. Suppose a table records each instructor's courses and spoken languages: instructor_skill(instructor, course, language). If Dr. Ruiz teaches 3 courses and speaks 2 languages, and the two facts are unrelated, the table needs all 3 × 2 = 6 combinations to avoid implying false links. Add a fourth course and you must add two rows. The fix is two tables, instructor_course and instructor_language, each holding one independent fact.
Fifth normal form (5NF) deals with rare cases where a table can only be split losslessly into three or more pieces.
In practice, careful ER modeling usually avoids these situations from the start: if you model "teaches" and "speaks" as two separate many-to-many relationships, you get two junction tables automatically. That's a general lesson. Normalization is a powerful check on a design, but a good conceptual model produces mostly normalized tables before you ever list a functional dependency.
Step 5 of 12Practice · Work it out
A table stores, for each instructor, every combination of the courses they teach and the languages they speak, which are independent facts. An instructor teaches 4 courses and speaks 3 languages. How many rows does this instructor need, and how many would the two 4NF tables need in total? Enter the difference.
Step 6 of 12Try the calculator
Why 4NF splits independent facts
Storing every course × language combination multiplies rows. Two separate tables only add them.
- Rows in one combined table
- 12
- Rows in two 4NF tables
- 7
- Rows to add for one new language (combined)
- 4
Step 7 of 12Learn
When to denormalize
Normalization optimizes for correctness and easy updates. Every fact lives in one place, so writes are simple and consistent. The price is that reading often requires joins: to show an order history with customer names and book titles, the database combines four tables. For most applications, with good indexes, those joins are fast and normalization is the right default.
Sometimes, though, reads vastly outnumber writes, or a few queries are so frequent and so heavy that joins become the bottleneck. Then designers denormalize on purpose: they store some data redundantly to make reads cheaper. Common forms:
- Stored derived values: keeping order_total in orders instead of summing lines every time an order list is displayed.
- Copied columns: storing customer_name in a frequently read report table.
- Summary tables: daily sales per book, refreshed each night.
- Star schemas in data warehouses: a central fact table (sales) surrounded by wide, denormalized dimension tables (date, product, store) designed for fast analysis rather than frequent updates.
The key word is deliberately. Denormalize after measuring a real performance problem, keep a normalized source of truth, and decide how the redundant copy stays in sync: a trigger, application code, or a scheduled refresh. Accidental redundancy is a bug; planned redundancy with a sync strategy is a design decision.
Step 8 of 12Compare
Normalized and denormalized designs
| Aspect | Normalized (3NF) | Denormalized |
|---|---|---|
| Main goal | Correctness; each fact stored once | Fast reads for specific queries |
| Writes | Simple: update one place | Must update every copy, or accept lag |
| Reads | May need several joins | Fewer or no joins |
| Risk | Slower complex queries without good indexes | Copies drifting out of sync |
| Typical home | Transactional systems: orders, banking, bookings | Reporting, analytics, data warehouses, caches |
Step 9 of 12Note
Step 10 of 12Practice · What would you do?
What would you do?
An online shop's order list page shows each order's total. Computing totals from order lines is fast today, with 5,000 orders. A developer wants to add a stored order_total column "for performance." What is the best advice?
Step 11 of 12Practice · Select all that apply
Which are legitimate reasons to denormalize part of a design? Select all that apply.
Select all that apply.
Step 12 of 12Practice · Choose one
Which statement about the tutoring table (student, subject, tutor), where tutor → subject and each student has one tutor per subject, is correct?
Lesson complete!