What is a join dependency, and what does Fifth Normal Form (also called Project-Join Normal Form) require? Describe the kind of table that can be in 4NF but not in 5NF.
answer
- join dependency = n-way lossless split
- MVD is the n = 2 case
- 5NF: every JD implied by candidate keys
- supplier-part-project cyclic rule
- pairwise splits lossy, three-way split works
basics
~20 sA join dependency says a table equals the join of several of its projections. 5NF requires every nontrivial join dependency to be implied by the candidate keys. The classic violation is a three-way relationship, such as supplier-part-project, that is exactly reconstructable from its three pairwise projections because of a cyclic business rule.
solid answer
~50 sA join dependency generalises the multivalued dependency from two pieces to n. It states that a table is the lossless join of several projections of itself; a multivalued dependency is the two-projection special case. 5NF, or Project-Join Normal Form, says every nontrivial join dependency present must be a consequence of the candidate keys, meaning any lossless split you could make is already trivial. The textbook violation is SupplierPartProject(supplier, part, project) under the business rule: if a supplier supplies a part, and that part is used by a project, and that supplier already serves that project, then that supplier supplies that part to that project. Under that cyclic rule the three-way table equals the join of its three binary projections, so it can be split into supplier-part, part-project and supplier-project with no loss. It is rare, hard to detect, and needs semantics rather than data. The split is only safe while the rule holds, and no standard constraint enforces it, so many teams knowingly stop short of 5NF.
code
text · 6 linesSupplierPartProject decomposes to
(S1, Bolt, Bridge) SP: (S1,Bolt) (S2,Bolt)
(S1, Bolt, Tunnel) PJ: (Bolt,Bridge) (Bolt,Tunnel)
(S2, Bolt, Bridge) SJ: (S1,Bridge) (S1,Tunnel) (S2,Bridge)
rule: S supplies P AND P used by J AND S serves J => S supplies P to Jgo deeper
Awareness is enough: 5NF is about splitting a table into three or more parts that rejoin exactly, and it almost never comes up.
Define the join dependency, state that a multivalued dependency is the two-piece case, and recognise the supplier-part-project example.
Explain why only the three-way split works, why the rule is semantic rather than data-derivable, and what enforcement costs after decomposing.
Judge whether the rule is a durable invariant, weigh silent-corruption risk against modest redundancy savings, and usually decline the decomposition with a documented reason.
## Join dependencies A join dependency on a table R names a set of column subsets R1..Rn and asserts that R always equals the natural join of its projections onto them. Nothing is lost by splitting R into those n pieces, and nothing spurious appears when they are rejoined. A multivalued dependency is exactly the n equals 2 case, which is why 5NF sits above 4NF. A join dependency is trivial if one of the pieces is the whole table. It is implied by the candidate keys when every piece contains a candidate key, in which case the split is uninteresting. ## The definition A table is in 5NF, also called Project-Join Normal Form, when every nontrivial join dependency it satisfies is implied by its candidate keys. Equivalently: the only lossless decompositions available are the boring ones that just repeat the key. 5NF implies 4NF, which implies BCNF. ## The classic counterexample SupplierPartProject(supplier, part, project) records that a given supplier supplies a given part to a given project. All three columns together form the key, so the table is in BCNF. Suppose neither pair of columns determines a set independently of the third, so no multivalued dependency holds and the table is in 4NF too. Now add a business rule with a cycle in it: whenever supplier S supplies part P at all, and part P is used by project J, and supplier S already serves project J, then S supplies P to J. Under that rule the three-way fact is fully recoverable from the three two-way facts. The join dependency on the three pairwise projections holds, none of those pieces contains the key, so the table violates 5NF. Decomposing into three binary tables removes redundancy: each pairwise fact is stored once instead of once per third value. Crucially, splitting into any two of the three pieces is lossy and produces spurious rows. Only the three-way split works, which is why 5NF is not reachable by repeatedly applying binary decompositions. ## Why this is rare and awkward Three things make 5NF a niche concern. First, the trigger is a specific cyclic rule of the form the pairwise facts imply the three-way fact. Most genuine ternary relationships are not like that; usually a supplier supplies a part to some projects and not others, and then no join dependency holds and the table is already in 5NF. Second, you cannot detect it from data. A snapshot might satisfy the join dependency by accident. Only the domain expert can say whether the cyclic rule is a permanent constraint. If you split on a coincidence and the rule later fails, the join now invents supplier-part-project rows that were never asserted, silent data corruption. Third, the decomposition is not self-enforcing. After splitting, inserting into the binary tables can create new three-way facts implicitly, which is desirable only if the rule really holds. There is no portable declarative constraint that says these three tables must remain consistent with the rule, so enforcement falls to application logic or triggers. ## What to say in an interview Define join dependency as the n-way generalisation of the multivalued dependency, state the key-implied condition, give the supplier-part-project shape with its cyclic rule, and then say the honest engineering conclusion: 5NF is a theoretical completeness result that almost never changes a production schema, and when it appears the deciding question is whether the rule is truly invariant.
- How is a join dependency related to a multivalued dependency?A multivalued dependency is the two-projection special case of a join dependency: it says the table is the lossless join of exactly two projections that share the determinant. A join dependency allows any number of projections, and some tables can only be split losslessly into three or more pieces at once. That is why 5NF is strictly stronger than 4NF.
- Why can 5NF violations not be detected from the data alone?A given snapshot may satisfy the join dependency by coincidence, especially when the table is small or sparse. The join dependency has to be a permanent business rule, not an accident of today's rows. If you decompose on a coincidence, later data that breaks the rule will be silently misrepresented, since rejoining the pieces invents combinations nobody asserted.
saying these in an interview costs you the question
- Claiming any table can be split into binary projections without loss
- Saying 5NF is just 4NF applied twice, when the three-way split cannot be reached by successive binary splits
- Treating a data snapshot that happens to be a cross product as proof of a join dependency
- Asserting the DBMS will keep the decomposed tables consistent with the rule automatically