Chapter 5

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 X→YX\to Y holds if any two tuples equal on attributes XX are also equal on YY. It is trivial when Y⊆XY\subseteq X. FF denotes the stated FD set; F+F^+ denotes every FD implied by it. Attribute strings such as XYXY 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 XX and repeatedly adding the right side of any FD whose left side is already present. Stop when a full pass adds nothing. To test X→YX\to Y, check whether Y⊆XF+Y\subseteq X_F^+. 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.

  1. Split every multi-attribute right side into singleton FDs.
  2. For X→AX\to A and B∈XB\in X, compute (X−{B})+(X-\{B\})^+ under the current FD set. If it contains AA, remove BB from that determinant.
  3. For an FD X→AX\to A, remove that FD temporarily and compute X+X^+. If it still contains AA, delete the FD permanently.
  4. 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 formTest, assuming 1NF
2NFNo non-prime attribute depends on a proper subset of any candidate key
3NFFor every nontrivial X→AX\to A in F+F^+, XX is a superkey or AA is prime
BCNFFor every nontrivial X→AX\to A in F+F^+, XX 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 RiR_i represents a legal relation rr by its projections πRi(r)\pi_{R_i}(r). Their natural join always contains the original tuples; a lossy decomposition can add spurious combinations. Losslessness must hold for every legal rr, not merely one convenient sample.

A preservation test avoiding explicit enumeration of FiF_i: for each original X→YX\to Y, initialise Z=XZ=X. Repeatedly, for every RiR_i, add ((Z∩Ri)F+∩Ri)((Z\cap R_i)^+_F\cap R_i) to ZZ. The dependency is preserved exactly when the fixed point contains YY.

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 aja_j in column jj if that component contains it; otherwise put a fresh bijb_{ij}. For each FD X→YX\to Y, rows agreeing in XX must agree in YY: unify symbols, preferring aja_j 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 X↠YX\twoheadrightarrow Y states that, for each fixed XX, the possible YY values vary independently of the remaining attributes Z=U−(X∪Y)Z=U-(X\cup Y). A pair of tuples agreeing on XX must permit the two swapped Y/ZY/Z 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 F+F^+.
  • 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 F+F^+ 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.

Revise offline: the whole Databases and Data Warehousing handbook as one PDF

58 pages · 2.7 MBFree to read online. Sign in to download the PDF.We save the handbook, version and request time in My downloads. Privacy policy

All chapters · Corrections