Quick revision
The short answer
In bookings(student, subject, tutor) the dependencies are (student, subject) -> tutor and tutor -> subject, so the candidate keys are (student, subject) and (student, tutor). The table is in 3NF, because subject is part of a candidate key, but not in BCNF, because tutor determines subject without being a superkey. Decomposing into tutors(tutor, subject) and assignments(student, tutor) reaches BCNF but loses the simple constraint that a student has one tutor per subject, which is the classic 3NF versus BCNF trade-off.
What to remember
In this answer, we found the two candidate keys of bookings from its dependencies and saw that tutor -> subject is allowed by 3NF, because subject is a prime attribute, but rejected by BCNF, because tutor is not a superkey. Decomposing into tutors and assignments removes the redundancy but loses the declarative rule of one tutor per subject per student, since BCNF decompositions are not always dependency preserving. In practice the difference only appears with overlapping candidate keys, and we choose between 3NF plus a check and BCNF plus a trigger or a composite foreign key.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
In bookings(student, subject, tutor) the dependencies are (student, subject) -> tutor and tutor -> subject, so the candidate keys are (student, subject) and (student, tutor). The table is in 3NF, because subject is part of a candidate key, but not in BCNF, because tutor determines subject without being a superkey. Decomposing into tutors(tutor, subject) and assignments(student, tutor) reaches BCNF but loses the simple constraint that a student has one tutor per subject, which is the classic 3NF versus BCNF trade-off.
Why this question is asked
Most of us learn normal forms as a ladder and stop at third normal form, because that is where most real designs land. BCNF is the step that only matters in a particular shape of table, and interviewers ask about it to see whether we understand dependencies well enough to spot that shape and to reason about what we give up by removing it. In this answer, we will recap functional dependencies and candidate keys, work out the keys of the bookings table, see exactly which rule of 3NF lets it pass and which rule of BCNF it fails, decompose it, and discuss what a practical design would do.
1A Quick Recap of Dependencies, Keys and Prime Attributes
A functional dependency A -> B means that rows with the same A always have the same B. A superkey is any set of columns that determines every other column, so no two rows can share it. A candidate key is a minimal superkey: remove any column and it stops being one. A table can have several candidate keys. A prime attribute is a column that belongs to at least one candidate key.
With those words the two normal forms are short to state. A table is in BCNF (Boyce-Codd normal form) when, for every non-trivial dependency X -> Y, X is a superkey. A table is in 3NF when, for every such dependency, X is a superkey or every column in Y is a prime attribute. That second escape clause is the only difference between them.
2Working Out the Keys of bookings
The rules of the business give two dependencies. A student has one tutor per subject, so (student, subject) -> tutor. Each tutor teaches only one subject, so tutor -> subject.
Is (student, subject) a key? Yes: it determines tutor, so it determines the whole row, and neither column alone does. Is (student, tutor) a key? Also yes: tutor determines subject, so student plus tutor gives us all three columns. Neither tutor alone (Kim teaches Ana and Ben) nor student alone is a key. So there are two overlapping candidate keys, and all three columns are prime attributes.
3Why It Passes 3NF but Fails BCNF
Now we test each dependency against both definitions.
| Dependency | Left side a superkey? | 3NF | BCNF |
|---|---|---|---|
| (student, subject) -> tutor | Yes | Passes | Passes |
| tutor -> subject | No | Passes: subject is prime | Fails |
tutor -> subject is the troublemaker. tutor is not a superkey, so BCNF rejects the table. 3NF accepts it because subject is part of a candidate key, and 3NF only complains about non-key columns depending on non-keys.
The anomaly is still real. The fact 'Kim teaches Maths' is repeated in every row where Kim appears. If Kim switches to Statistics, we must update all of them, and if we miss one the table claims Kim teaches two subjects. If Kim's last student leaves, we lose the fact that Kim teaches Maths at all.
4Decomposing to BCNF and What It Costs
The standard fix is to put the offending dependency into its own table.
Both tables are in BCNF, and the join on tutor is lossless because tutor is the key of tutors. But look at the last insert. The rule (student, subject) -> tutor used to be enforced by a primary key on one table; now student is in one table and subject in another, so no unique constraint can express it. The decomposition is lossless but not dependency preserving.
This is a known result, not a flaw in our design: a 3NF decomposition that is lossless and dependency preserving always exists, but a BCNF one sometimes does not. So we choose. We can keep the 3NF table and accept the small redundancy, protecting tutor -> subject with a trigger or with a composite foreign key from (tutor, subject) to tutors. Or we go to BCNF and enforce one tutor per subject in another way, such as a trigger or a denormalized subject column in assignments with a unique constraint on (student, subject) and a composite foreign key (tutor, subject) to tutors.
5How Often This Matters in Practice
Rarely, and it helps to say so in an interview. Most real tables have one candidate key, usually a surrogate id, plus perhaps a unique business key, and a table in 3NF with a single candidate key is automatically in BCNF. The gap appears only when candidate keys overlap, as (student, subject) and (student, tutor) do here by sharing student. Scheduling, assignment and allocation tables are where we meet it most, so those are the tables worth checking dependency by dependency.
6Follow-up questions
What is a functional dependency?
It is a rule that one set of columns determines another: if two rows agree on the left side, they must agree on the right side. tutor -> subject means two rows with the same tutor always have the same subject. Dependencies come from the business rules, not from the data that happens to be in the table today, which is why we ask people how the domain works before deciding on keys.
Can the composite foreign key trick keep both rules in the BCNF design?
Yes, with some redundancy. Add a unique constraint on tutors(tutor, subject), store subject in assignments too, add a unique constraint on assignments(student, subject), and a foreign key from assignments(tutor, subject) to tutors(tutor, subject). The foreign key keeps the copied subject consistent with the tutor, and the unique constraint enforces one tutor per subject per student. Strictly the table is no longer in BCNF, but the database enforces every rule declaratively.
Is BCNF stronger than 3NF in every case?
Yes. Every table in BCNF is in 3NF, because BCNF's condition is the 3NF condition without the prime attribute exception. The reverse holds only when the special case of overlapping candidate keys does not occur.
7Conclusion
In this answer, we found the two candidate keys of bookings from its dependencies and saw that tutor -> subject is allowed by 3NF, because subject is a prime attribute, but rejected by BCNF, because tutor is not a superkey. Decomposing into tutors and assignments removes the redundancy but loses the declarative rule of one tutor per subject per student, since BCNF decompositions are not always dependency preserving. In practice the difference only appears with overlapping candidate keys, and we choose between 3NF plus a check and BCNF plus a trigger or a composite foreign key.
Open with
I would start with the dependencies. A student has one tutor per subject, so student and subject determine tutor, and each tutor teaches one subject, so tutor determines subject.
Then, if they want more
That gives two candidate keys: student plus subject, and student plus tutor, since tutor brings subject with it. BCNF says every determinant must be a superkey, and tutor is not, so the table violates BCNF. 3NF has an extra exception: a dependency is allowed if the right side is a prime attribute, meaning part of some candidate key.
Subject is part of student plus subject, so the table is in 3NF. The redundancy is still there: 'Kim teaches Maths' is repeated for every student Kim has. To reach BCNF I would split into tutors with tutor and subject, and assignments with student and tutor.
That is lossless, but now I can no longer enforce one tutor per subject per student with a simple unique constraint, because student and subject live in different tables. That is the known trade-off: BCNF is not always dependency preserving, while 3NF always can be.
So I might keep 3NF and protect tutor to subject with a check, or go BCNF and use a trigger or a composite foreign key. In practice this only shows up with overlapping candidate keys; most surrogate-key designs in 3NF are already BCNF.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- PostgreSQL documentation, MySQL reference manual
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Explain the difference between 3NF and BCNF using a table where it matters, for example...": https://scrivio-interview-library.netlify.app/databases/data-modeling/d46bb8e171/