Functional dependencies and normal forms
Dependencies describe every legal instance, not just the currently displayed rows. Find all candidate keys before testing normal forms. Lossless decomposition and dependency preservation are separate properties and need separate tests.
5.1 Functional dependencies and inference
Past papers · CS 2014–2026 (23 papers): 6 questions, 10 marks
An FD holds if any two tuples equal on attributes are also equal on . It is trivial when . denotes the stated FD set; denotes every FD implied by it. Attribute strings such as mean set union, not multiplication.
5.2 Attribute closure and finding all keys
Past papers · CS 2014–2026 (23 papers): 1 question, 1 mark · DA 2024–2026 (3 papers): 3 questions, 5 marks
Compute closure by starting with and repeatedly adding the right side of any FD whose left side is already present. Stop when a full pass adds nothing. To test , check whether . Two FD sets are equivalent if every dependency of each follows from the other.
Attributes absent from every right side of the given FD set must occur in every key. Start with these mandatory attributes, then add combinations of remaining attributes in increasing size. Skip supersets of keys already found, but do not stop after finding one key. An attribute appearing only on right sides and never on left sides cannot help determine a new attribute, so need not be added to a minimal key.
5.3 Minimal covers and extraneous attributes
Past papers · CS 2014–2026 (23 papers): 1 question, 1 mark
A minimal cover is an equivalent FD set with singleton right sides, no extraneous left-side attribute and no redundant FD. It need not be unique and need not have the globally smallest number of written symbols.
- Split every multi-attribute right side into singleton FDs.
- For and , compute under the current FD set. If it contains , remove from that determinant.
- For an FD , remove that FD temporarily and compute . If it still contains , delete the FD permanently.
- Recheck after changes. Combine equal left sides only when a canonical-cover presentation permits it.
5.4 1NF, 2NF, 3NF and BCNF
Past papers · CS 2014–2026 (23 papers): 7 questions, 11 marks
1NF requires atomic values at the chosen relational level: no repeating group or set of phone numbers in one cell. A composite key is allowed. A composite ER attribute is flattened into simple columns, rather than confused with a composite key.
| Normal form | Test, assuming 1NF |
|---|---|
| 2NF | No non-prime attribute depends on a proper subset of any candidate key |
| 3NF | For every nontrivial in , is a superkey or is prime |
| BCNF | For every nontrivial in , is a superkey |
A full functional dependency needs the whole determinant; a partial dependency needs only a proper subset. A transitive dependency can create an update anomaly even with a single-attribute key. BCNF implies 3NF, which implies 2NF, which implies 1NF. The converses fail. A schema with all attributes prime is automatically in 3NF, but may violate BCNF.
Redundancy can cause update, insertion and deletion anomalies. Normal forms control particular dependency patterns; they do not promise removal of every possible kind of redundancy or every business-rule anomaly.
5.5 Lossless joins and dependency preservation
Past papers · CS 2014–2026 (23 papers): 4 questions, 7 marks · DA 2024–2026 (3 papers): 1 question, 1 mark
A decomposition into schemas represents a legal relation by its projections . Their natural join always contains the original tuples; a lossy decomposition can add spurious combinations. Losslessness must hold for every legal , not merely one convenient sample.
A preservation test avoiding explicit enumeration of : for each original , initialise . Repeatedly, for every , add to . The dependency is preserved exactly when the fixed point contains .
For three or more components, use a sequence of valid binary splits or the FD chase. Create one row per component and one column per original attribute. Put the common distinguished symbol in column if that component contains it; otherwise put a fresh . For each FD , rows agreeing in must agree in : unify symbols, preferring in its column. Propagate substitutions throughout the tableau until stable. A row containing only distinguished symbols proves losslessness; if no such row exists at the fixed point, the FD-only decomposition is lossy.
5.6 Multivalued dependencies and higher normal forms
An MVD states that, for each fixed , the possible values vary independently of the remaining attributes . A pair of tuples agreeing on must permit the two swapped combinations too. Every FD implies the corresponding MVD; the converse fails.
If a person's independent hobbies and languages are stored together, every hobby–language pair is required. Split into PersonHobby and PersonLanguage to remove this cross-product redundancy. If particular hobbies are tied to particular languages, the MVD assumption is false and that split loses information.
A join dependency states that a relation equals the join of several specified projections. 5NF, or projection–join normal form, requires every nontrivial join dependency to be implied by candidate keys. This addresses dependencies involving three or more projections that cannot always be captured by a single binary MVD split. The usual hierarchy is 5NF ⇒ 4NF ⇒ BCNF ⇒ 3NF ⇒ 2NF ⇒ 1NF.
Last-minute recall
- Split right sides of FDs freely; never split determinants without proof.
- Closure tests implications, superkeys and key minimality.
- Minimal covers can differ while defining the same .
- 3NF permits a non-superkey determinant when the single dependent attribute is prime.
- Lossless means no spurious joined tuples; preserving means constraints can be enforced locally.
- Project onto a component, not just FDs originally written inside it.
- BCNF decomposition is lossless but may lose dependency preservation.
- 3NF synthesis needs a key-containing component for its lossless guarantee.