![Page 1: Relational Design Theory Boyce-Codd Normal FormRelational design by decomposition “Mega” relations + properties of the data System decomposes based on properties Final set of relations](https://reader030.vdocuments.mx/reader030/viewer/2022040905/5e7a208926c6b807b3104122/html5/thumbnails/1.jpg)
Jennifer Widom
Relational Design Theory
Boyce-Codd Normal Form
![Page 2: Relational Design Theory Boyce-Codd Normal FormRelational design by decomposition “Mega” relations + properties of the data System decomposes based on properties Final set of relations](https://reader030.vdocuments.mx/reader030/viewer/2022040905/5e7a208926c6b807b3104122/html5/thumbnails/2.jpg)
Jennifer Widom
Relational design by decomposition
“Mega” relations + properties of the data System decomposes based on properties Final set of relations satisfies normal form
– No anomalies, no lost information
Functional dependencies Boyce-Codd Normal Form Multivalued dependences Fourth Normal Form
BCNF
![Page 3: Relational Design Theory Boyce-Codd Normal FormRelational design by decomposition “Mega” relations + properties of the data System decomposes based on properties Final set of relations](https://reader030.vdocuments.mx/reader030/viewer/2022040905/5e7a208926c6b807b3104122/html5/thumbnails/3.jpg)
Jennifer Widom
Decomposition of a relational schema
BCNF
![Page 4: Relational Design Theory Boyce-Codd Normal FormRelational design by decomposition “Mega” relations + properties of the data System decomposes based on properties Final set of relations](https://reader030.vdocuments.mx/reader030/viewer/2022040905/5e7a208926c6b807b3104122/html5/thumbnails/4.jpg)
Jennifer Widom
Decomposition Example #1
Student(SSN, sName, address, HScode, HSname, HScity, GPA, priority)
BCNF
![Page 5: Relational Design Theory Boyce-Codd Normal FormRelational design by decomposition “Mega” relations + properties of the data System decomposes based on properties Final set of relations](https://reader030.vdocuments.mx/reader030/viewer/2022040905/5e7a208926c6b807b3104122/html5/thumbnails/5.jpg)
Jennifer Widom
Decomposition Example #2
Student(SSN, sName, address, HScode, HSname, HScity, GPA, priority)
BCNF
![Page 6: Relational Design Theory Boyce-Codd Normal FormRelational design by decomposition “Mega” relations + properties of the data System decomposes based on properties Final set of relations](https://reader030.vdocuments.mx/reader030/viewer/2022040905/5e7a208926c6b807b3104122/html5/thumbnails/6.jpg)
Jennifer Widom
Relational design by decomposition
“Mega” relations + properties of the data System decomposes based on properties
“Good” decompositions only Into “good” relations
BCNF
![Page 7: Relational Design Theory Boyce-Codd Normal FormRelational design by decomposition “Mega” relations + properties of the data System decomposes based on properties Final set of relations](https://reader030.vdocuments.mx/reader030/viewer/2022040905/5e7a208926c6b807b3104122/html5/thumbnails/7.jpg)
Jennifer Widom
Boyce-Codd Normal Form
Relation R with FDs is in BCNF if: For each Ᾱ B, Ᾱ is a key
BCNF
![Page 8: Relational Design Theory Boyce-Codd Normal FormRelational design by decomposition “Mega” relations + properties of the data System decomposes based on properties Final set of relations](https://reader030.vdocuments.mx/reader030/viewer/2022040905/5e7a208926c6b807b3104122/html5/thumbnails/8.jpg)
Jennifer Widom
BCNF? Example #1
Student(SSN, sName, address, HScode, HSname, HScity, GPA, priority)
SSN sName, address, GPA
GPA priority
HScode HSname, HScity
BCNF
![Page 9: Relational Design Theory Boyce-Codd Normal FormRelational design by decomposition “Mega” relations + properties of the data System decomposes based on properties Final set of relations](https://reader030.vdocuments.mx/reader030/viewer/2022040905/5e7a208926c6b807b3104122/html5/thumbnails/9.jpg)
Jennifer Widom
BCNF? Example #2
Apply(SSN, cName, state, date, major)
SSN, cName, state date, major
BCNF
![Page 10: Relational Design Theory Boyce-Codd Normal FormRelational design by decomposition “Mega” relations + properties of the data System decomposes based on properties Final set of relations](https://reader030.vdocuments.mx/reader030/viewer/2022040905/5e7a208926c6b807b3104122/html5/thumbnails/10.jpg)
Jennifer Widom
Relational design by decomposition
“Mega” relations + properties of the data System decomposes based on properties
“Good” decompositions only Into “good” relations
BCNF
![Page 11: Relational Design Theory Boyce-Codd Normal FormRelational design by decomposition “Mega” relations + properties of the data System decomposes based on properties Final set of relations](https://reader030.vdocuments.mx/reader030/viewer/2022040905/5e7a208926c6b807b3104122/html5/thumbnails/11.jpg)
Jennifer Widom
BCNF decomposition algorithm
Input: relation R + FDs for R Output: decomposition of R into BCNF relations with “lossless join”
Compute keys for R
Repeat until all relations are in BCNF:
Pick any R’ with A B that violates BCNF
Decompose R’ into R1(A, B) and R2(A, rest)
Compute FDs for R1 and R2
Compute keys for R1 and R2
BCNF
![Page 12: Relational Design Theory Boyce-Codd Normal FormRelational design by decomposition “Mega” relations + properties of the data System decomposes based on properties Final set of relations](https://reader030.vdocuments.mx/reader030/viewer/2022040905/5e7a208926c6b807b3104122/html5/thumbnails/12.jpg)
Jennifer Widom
BCNF Decomposition Example Student(SSN, sName, address, HScode, HSname, HScity,
GPA, priority)
SSN sName, address, GPA GPA priority
HScode HSname, HScity
BCNF
![Page 13: Relational Design Theory Boyce-Codd Normal FormRelational design by decomposition “Mega” relations + properties of the data System decomposes based on properties Final set of relations](https://reader030.vdocuments.mx/reader030/viewer/2022040905/5e7a208926c6b807b3104122/html5/thumbnails/13.jpg)
Jennifer Widom
BCNF decomposition algorithm
Input: relation R + FDs for R Output: decomposition of R into BCNF relations with “lossless join”
Compute keys for R
Repeat until all relations are in BCNF:
Pick any R’ with A B that violates BCNF
Decompose R’ into R1(A, B) and R2(A, rest)
Compute FDs for R1 and R2
Compute keys for R1 and R2
BCNF
![Page 14: Relational Design Theory Boyce-Codd Normal FormRelational design by decomposition “Mega” relations + properties of the data System decomposes based on properties Final set of relations](https://reader030.vdocuments.mx/reader030/viewer/2022040905/5e7a208926c6b807b3104122/html5/thumbnails/14.jpg)
Jennifer Widom
Does BCNF guarantee a good decomposition?
Removes anomalies? Can logically reconstruct original relation?
Too few or too many tuples?
BCNF
![Page 15: Relational Design Theory Boyce-Codd Normal FormRelational design by decomposition “Mega” relations + properties of the data System decomposes based on properties Final set of relations](https://reader030.vdocuments.mx/reader030/viewer/2022040905/5e7a208926c6b807b3104122/html5/thumbnails/15.jpg)
Jennifer Widom
Does BCNF guarantee a good decomposition?
Removes anomalies? Can logically reconstruct original relation?
Too few or too many tuples?
Some shortcomings discussed in later video
BCNF