Skip to main content

Multivalued Dependencies (4NF) & Join Dependencies (5NF)

📚Module 01Topic 1.1⏱️5 min read
🎯High-Yield For:Semester Exams • GATE CSE • Technical Interviews

💡 Core Intuition​

🍳 The Everyday Analogy: The Multi-Hobby Resume Dilemma​

Imagine drafting an applicant profile where you list two completely independent multi-valued facts about an engineer: the programming languages they master (Java, Rust) and the sports they play (Tennis, Swimming).

If you force these two independent lists into a single flat relational table, you face a combinatorial explosion. Because neither list has anything to do with the other, relational integrity forces you to cross-multiply every programming language with every sport:

(Alice, Java, Tennis),(Alice, Java, Swimming),(Alice, Rust, Tennis),(Alice, Rust, Swimming)\text{(Alice, Java, Tennis)}, \quad \text{(Alice, Java, Swimming)}, \quad \text{(Alice, Rust, Tennis)}, \quad \text{(Alice, Rust, Swimming)}

If Alice learns a 3rd language (Go), you cannot simply append one row—you must insert multiple rows paired with all her sports! If she has 1010 languages and 55 sports, you store 5050 tuples for a single human being. This cross-product redundancy is caused by independent Multivalued Dependencies (MVDs) violating Fourth Normal Form (4NF). The solution is simple: split the profile into two independent tables—one for skills, and one for sports.

💻 Bridging to Computer Science​

Up to Boyce-Codd Normal Form (BCNF), normalization focuses exclusively on Functional Dependencies (X→YX \to Y). However, a table can be in BCNF and still suffer from severe redundancy if it models independent one-to-many relationships within the same relation schema.

BCNF (Zero FD Redundancy)  >>>  4NF (Zero MVD Redundancy)  >>>  5NF (Zero JD Redundancy)

Fourth Normal Form (4NF) eliminates independent multivalued attributes. Fifth Normal Form (5NF or Project-Join Normal Form - PJNF) handles complex NN-way join dependencies where a table can only be losslessly reconstructed by joining three or more sub-relations simultaneously.



📚 Core Deep-Dive & Concepts​

What is a Multivalued Dependency (MVD)?​

Definition: A Multivalued Dependency (MVD) occurs as a direct structural consequence of First Normal Form (1NF), which disallows an attribute from storing a set or list of values within a single tuple cell.

Denoted by: A↠BA \twoheadrightarrow B Read as: "AA multidetermines BB".

It signifies that for a given value of AA, there exists a well-defined set of values of BB, and this set of BB values is completely independent of all other attributes in the relation.

Formal Tuple Permutation Definition​

In a relation R(A,B,C)R(A, B, C), the MVD A↠BA \twoheadrightarrow B holds if and only if: Whenever two tuples t1t_1 and t2t_2 exist in RR such that t1[A]=t2[A]t_1[A] = t_2[A], then there must also exist two tuples t3t_3 and t4t_4 in RR such that: t3[A]=t1[A],t3[B]=t1[B],t3[C]=t2[C]t_3[A] = t_1[A], \quad t_3[B] = t_1[B], \quad t_3[C] = t_2[C] t4[A]=t1[A],t4[B]=t2[B],t4[C]=t1[C]t_4[A] = t_1[A], \quad t_4[B] = t_2[B], \quad t_4[C] = t_1[C]

In simpler terms: the values of BB and CC appear in all Cartesian combinations for each unique value of AA.

Functional Dependency vs. Multivalued Dependency​

DimensionFunctional Dependency (A→BA \to B)Multivalued Dependency (A↠BA \twoheadrightarrow B)
CardinalitySingle-valued: each AA maps to exactly one BB.Multi-valued: each AA maps to a set of BB values.
Duplicate KeysIf t1[A]=t2[A]t_1[A] = t_2[A], then t1[B]t_1[B] must equal t2[B]t_2[B].If t1[A]=t2[A]t_1[A] = t_2[A], t1[B]t_1[B] and t2[B]t_2[B] may be different.
ImplicationIf A→BA \to B, then A↠BA \twoheadrightarrow B is always true.If A↠BA \twoheadrightarrow B, A→BA \to B is not necessarily true.

The Subsumption Rule: Every functional dependency is a special degenerate case of a multivalued dependency where the associated value set contains exactly one element.


Trivial Multivalued Dependencies​

A multivalued dependency X↠YX \twoheadrightarrow Y in relation RR is Trivial if:

  1. YY is a subset of XX (Y⊆XY \subseteq X), OR
  2. X∪YX \cup Y forms the entire attribute set of RR (X∪Y=Attr(R)X \cup Y = \text{Attr}(R)).

Examples of Trivial MVDs​

  • In relation R(A,B)R(A, B), the MVD A↠BA \twoheadrightarrow B is trivial because {A}∪{B}=Attr(R)\{A\} \cup \{B\} = \text{Attr}(R).
  • In relation R(A,B,C,D)R(A, B, C, D), the dependency AB↠CDAB \twoheadrightarrow CD is trivial because {A,B}∪{C,D}=Attr(R)\{A, B\} \cup \{C, D\} = \text{Attr}(R).

A trivial MVD cannot cause data redundancy because there are no third-party independent attributes to cross-multiply.


The Combinatorial Redundancy Problem​

Consider a student activity table: Student_Activities(S_Name,Club_Name,Phone_No)\text{Student\_Activities}(\text{S\_Name}, \text{Club\_Name}, \text{Phone\_No})

A student can join multiple clubs and register multiple phone numbers. Clubs and phone numbers are completely independent: S_Name↠Club_Name\text{S\_Name} \twoheadrightarrow \text{Club\_Name} S_Name↠Phone_No\text{S\_Name} \twoheadrightarrow \text{Phone\_No}

Instance demonstration:

S_NameClub_NamePhone_No
KameshDance123
KameshGuitar123
KameshDance789
KameshGuitar789

Notice how Kamesh's 2 clubs and 2 phone numbers force 2×2=42 \times 2 = 4 tuples into the table. If Kamesh adds a 3rd club, 22 more rows must be inserted. If an attribute has mm values and another has nn values, the table stores m×nm \times n tuples!


Fourth Normal Form (4NF)​

Definition: A relation schema RR is in Fourth Normal Form (4NF) if and only if:

  1. RR is in Boyce-Codd Normal Form (BCNF).
  2. For every non-trivial multivalued dependency X↠YX \twoheadrightarrow Y holding on RR, XX is a Superkey of RR.

If a non-trivial MVD X↠YX \twoheadrightarrow Y exists and XX is not a superkey, the relation violates 4NF.

Resolving 4NF Violations via Decomposition​

To decompose a table violating 4NF along X↠YX \twoheadrightarrow Y:

  1. R1(X,Y)R_1(X, Y)
  2. R2(X,Attr(R)−Y)R_2(X, \text{Attr}(R) - Y)

Applying this decomposition to our student activities table:

  1. R1(S_Name,Club_Name)R_1(\text{S\_Name}, \text{Club\_Name}): Stores (Kamesh,Dance)(\text{Kamesh}, \text{Dance}) and (Kamesh,Guitar)(\text{Kamesh}, \text{Guitar}) (22 tuples).
  2. R2(S_Name,Phone_No)R_2(\text{S\_Name}, \text{Phone\_No}): Stores (Kamesh,123)(\text{Kamesh}, 123) and (Kamesh,789)(\text{Kamesh}, 789) (22 tuples).

In each sub-table, the respective MVD becomes trivial (covering all attributes of the sub-relation). Total rows stored drop from 44 to 44, and scaling drops from multiplicative O(m×n)O(m \times n) to additive O(m+n)O(m + n).


Fifth Normal Form (5NF / Project-Join Normal Form)​

Definition: A Multivalued Dependency is a special 2-way case of a Join Dependency (JD).

A relation schema RR satisfies the Join Dependency: ⋈(R1,R2,…,Rn)\bowtie(R_1, R_2, \dots, R_n) if and only if RR is equal to the natural join of its projections on R1,R2,…,RnR_1, R_2, \dots, R_n: R=ΠR1(R)⋈ΠR2(R)⋈⋯⋈ΠRn(R)R = \Pi_{R_1}(R) \bowtie \Pi_{R_2}(R) \bowtie \dots \bowtie \Pi_{R_n}(R)

Fifth Normal Form (5NF / PJNF): A relation schema RR is in 5NF if and only if every non-trivial join dependency ⋈(R1,R2,…,Rn)\bowtie(R_1, R_2, \dots, R_n) holding on RR is implied by the candidate keys of RR.

That is, a table is in 5NF if it cannot be losslessly decomposed into smaller tables unless those decompositions share candidate keys. 5NF eliminates cyclic join dependencies (such as a 3-way relationship between Supplier, Part, and Project where business rules dictate that a supplier supplies a part to a project only when all three pairwise interactions exist).


The 4 Fundamental Structural Theorems of Higher Normal Forms​

  1. Composite Key Prerequisite for 4NF Violation: A relation schema RR will necessarily possess a composite candidate key if RR is in BCNF but not in 4NF.

  2. Simple Key 4NF Guarantee: If a relation schema RR is in BCNF and has at least one simple (single-attribute) candidate key, then RR is guaranteed to be in 4NF.

  3. Simple Key 5NF Guarantee: If a relation schema RR is in 3NF and every candidate key is simple, then RR is guaranteed to be in 5NF.

  4. Trivial MVD Reduction: When an MVD X↠YX \twoheadrightarrow Y is decomposed into a separate relation containing only X∪YX \cup Y, the dependency becomes trivial in the new relation, instantly satisfying 4NF.


📐 Architecture / Visual Blueprint​

The following structural diagram summarizes how normal forms progressively eliminate different classifications of data redundancies:


🏭 In The Real World: Production Case Study​

Developer Profile Tagging at Scale (GitHub / LinkedIn)​

A professional developer network manages profiles with independent attributes for technical proficiencies and spoken languages.

The Flawed BCNF Schema​

Developer_Profiles(Dev_ID,Coding_Language,Spoken_Language)\text{Developer\_Profiles}(\text{Dev\_ID}, \text{Coding\_Language}, \text{Spoken\_Language})

Business Rules:

  • A developer codes in multiple languages (Dev_ID↠Coding_Language\text{Dev\_ID} \twoheadrightarrow \text{Coding\_Language}).
  • A developer speaks multiple natural languages (Dev_ID↠Spoken_Language\text{Dev\_ID} \twoheadrightarrow \text{Spoken\_Language}).
  • No functional dependencies exist between coding languages and spoken languages.
  • The candidate key is the entire composite triple: CK={Dev_ID,Coding_Language,Spoken_Language}CK = \{\text{Dev\_ID}, \text{Coding\_Language}, \text{Spoken\_Language}\}

The BCNF Paradox​

Because there are zero non-trivial functional dependencies, the table is trivially in BCNF!

However, consider an experienced engineer:

  • Codes in 1212 languages (Rust, Python, Go, TypeScript, C++, etc.)
  • Speaks 44 natural languages (English, Spanish, French, German)

To store this engineer's profile, the relational database is forced to store: 12×4=48 tuples12 \times 4 = 48 \text{ tuples}

Across 100 million100\text{ million} developers, this schema bloats table storage by tens of gigabytes, multiplies index sizes, and creates devastating update anomalies: deleting one spoken language requires issuing 1212 separate row deletions.

The 4NF Resolution​

Decompose into two independent relations:

  1. Developer_Skills (Dev_ID,Coding_Language‾)(\underline{\text{Dev\_ID}, \text{Coding\_Language}}): 1212 tuples.
  2. Developer_Languages (Dev_ID,Spoken_Language‾)(\underline{\text{Dev\_ID}, \text{Spoken\_Language}}): 44 tuples.

Total rows stored drop from 4848 to 1616 (a 66%66\% reduction per user), write transactions require single row operations, and cache hit rates improve drastically.


🎯 Exam & Interview Pitfall Check​

Core Conceptual Questions

Question 1: Relation R(A,B,C)R(A, B, C) has no functional dependencies. The candidate key is ABCABC. The relation satisfies the multivalued dependency A↠BA \twoheadrightarrow B. Determine whether RR is in 3NF, BCNF, and 4NF.

Answer:

  1. 3NF & BCNF Evaluation: Since there are no non-trivial functional dependencies, there are no functional dependencies violating 3NF or BCNF. Hence, relation RR is trivially in 3NF and BCNF.
  2. 4NF Evaluation: We are given a non-trivial multivalued dependency: A↠BA \twoheadrightarrow B For RR to be in 4NF, the determinant AA must be a superkey of RR. Since the only candidate key is {ABC}\{ABC\}, AA is not a superkey.
  3. Therefore, relation RR is in 3NF and BCNF, but NOT in 4NF.

Question 2: If a relation schema RR is in BCNF and has a single-attribute candidate key, can it violate 4NF?

Answer: No, it cannot. By theorem, if a relation RR is in BCNF and contains at least one simple candidate key K={A}K = \{A\}, then RR is guaranteed to be in 4NF. A violation of 4NF requires an MVD X↠YX \twoheadrightarrow Y where XX is not a superkey. In a relation with a simple key, any independent one-to-many relationship either stems from the key itself (making XX a superkey) or stems from a non-key attribute (which would have introduced an FD or violated BCNF). Therefore, 4NF violations can only occur in relations where all candidate keys are composite.

Common Interview Traps

Trap 1: Assuming that reaching BCNF eliminates all relational data redundancy. BCNF only eliminates redundancy that stems from Functional Dependencies. Redundancies caused by independent Multivalued Dependencies (Cartesian cross-product tuples) persist until the schema is normalized to 4NF.

Trap 2: Believing that A↠BA \twoheadrightarrow B means BB functionally determines AA. A↠BA \twoheadrightarrow B describes a multi-valued mapping from AA to a set of BB values. It implies nothing about the reverse direction (B→AB \to A or B↠AB \twoheadrightarrow A). In fact, by MVD complementation rule, A↠BA \twoheadrightarrow B in R(A,B,C)R(A, B, C) implies A↠CA \twoheadrightarrow C, not B→AB \to A.


💬

Discussion & Doubts