Sub topic 3
First Normal Form
This chapter assumes you know set notation, what a table, row, and column are, how a candidate key identifies a row, and basic SQL CREATE TABLE. It covers the normal forms in order, then the tests for lossless join and dependency preservation.
First Normal Form
A relation is in 1NF (first normal form) when every attribute holds atomic values, meaning one value per cell, and no row contains a repeating group.
| emp_id | name | phones (not 1NF) |
|---|---|---|
| 1 | Ana | 555-01, 555-02 |
Splitting the phones into one row per number makes the table 1NF.
Second Normal Form
A relation is in 2NF when it is in 1NF and no non-prime attribute depends on part of a candidate key. A prime attribute belongs to some candidate key.
Third Normal Form
A relation is in 3NF when, for every nontrivial FD X → A, either X is a superkey or A is prime. This rule removes transitive dependencies of non-prime attributes.
Boyce-Codd Normal Form
A relation is in BCNF when, for every nontrivial FD X → A, X is a superkey. BCNF is stricter than 3NF.
Take R(A, B, C) with FDs AB → C and C → B. The candidate keys are AB and AC, and all three attributes are prime, so R is in 3NF. C is not a superkey, so R is not in BCNF. Decomposing into R1(C, B) and R2(A, C) gives BCNF, but the FD AB → C is lost.
Minimal Cover of a Set of FDs
A minimal cover is an equivalent set of FDs with three properties: each right side has one attribute, no left-side attribute is extraneous, and no FD is redundant.
Lossless Join and Dependency Preservation
A binary decomposition of R into R1 and R2 is lossless when R1 ∩ R2 → R1 or R1 ∩ R2 → R2 holds. Dependency preservation means every FD in the original set can be derived from the FDs that hold within the decomposed relations.
Multivalued Dependencies and 4NF
A multivalued dependency X ->> Y holds when the values of Y depend on X independently of other attributes. A relation is in 4NF when, for every nontrivial MVD X ->> Y, X is a superkey.
Join Dependencies and 5NF
A join dependency says a relation equals the join of its projections. A relation is in 5NF when every nontrivial join dependency is implied by its candidate keys.
Exercise
Exercise
Is R(A, B, C) with FDs AB → C and C → B in BCNF?
Show answer
No. C → B is nontrivial, and C is not a superkey because its closure {C, B} does not contain A.