220 likes | 344 Views
Agenda. Functional Dependencies for Relational Databases Normalization for Relational Databases. Normalization for Relational Databases. Normal Forms Based on Primary Keys Second and Third Normal Forms Boyce-Codd Normal Form.
E N D
Agenda • Functional Dependencies for Relational Databases • Normalization for Relational Databases
Normalization for Relational Databases • Normal Forms Based on Primary Keys • Second and Third Normal Forms • Boyce-Codd Normal Form
Relation Schema that is not in First Normal Form-due to multi-values in location Elmasri, p. 359
First Normal Form Relation with Redundancy Elmasri, p. 315
3 solutions • 1. Separate table • 2. Expand key (dnumber, location) • 3. For known maximum values - put one column for each • Elmasri p. 360
1st NF • No multi-valued columns • Includes no nested tables - as shown on next slide
“Nested Relation” PROJS Within EMP_PROJ Elmasri, p. 361
Extension of EMP_PROJ Relation With Nested Relations Within Each Tuple Elmasri, p. 361
Decomposing EMP_PROJ into First Normal Form Relations by Migrating the Primary Key Elmasri, p. 361
Normalization for Relational Databases • Normal Forms Based on Primary Keys • Second and Third Normal Forms • Boyce-Codd Normal Form
Normalizing EMP_PROJ into 2NF Relations Elmasri, p. 363
2 NF • “Full functional” dependency • Need all of the composite key
Normalizing EMP_DEPT into 3NF Relations Elmasri, p. 363
3 NF • No transitive dependencies
So - 3 NF • Every column must depend on the key, the whole key, and nothing else
LOTS Relation Schema and Functional Dependencies-next 3 Elmasri, p. 366
Decomposing LOTS into 2NF Relations Elmasri, p. 366
Decomposing LOTS1 into 3NF Relations Elmasri, p. 366
Summary of LOTS Normalization Elmasri, p. 366
Normalization for Relational Databases • Normal Forms Based on Primary Keys • Second and Third Normal Forms • Boyce-Codd Normal Form
Boyce-Codd Normal Form (BCNF) (a) BCNF normalization with the dependency of fd2 being “lost” in the decomposition (b) A relation R in 3NF but not in BCNF Elmasri, p. 369
BCNF • Stronger than 3 NF • Says - any dependency in a table must be explicit (Post p. 86)