Download presentation
Presentation is loading. Please wait.
1
Winter 2007ACS - 3902 Ron McFadyen1 Multivalued Dependencies and 4NF Some relations can exist that are in BCNF but they have redundant data and have update anomalies The next highest normal form is 4NF 4NF is based on multivalued dependencies
2
Winter 2007ACS - 3902 Ron McFadyen2 Multivalued Dependencies Consider a relation R comprising attributes X U Y U Z where X, Y, Z are sets of atttributes The multivalued dependency, X Y, exists if when two tuples exist having the same X values: T1(x, y1, z1) and T2(x, y2, z2), implies the two tuples T4(x, y2, z1) and T3(x, y1, z2) also exist The MVD X Y is also written as X Y | Z
3
Winter 2007ACS - 3902 Ron McFadyen3 Multivalued Dependencies Example. Suppose we have two one-to-many relationships: Each employee may have many dependents Each employee may work on many projects For any employee, the dependants are completely independent of the projects For a given value of ename, the values of pname are only determined by ename and not pname For a given value of ename, the values of dname are only determined by ename and not pname So, each ename is repeated for each pname, and each pname is repeated for each dname See figure 11.5
4
Winter 2007ACS - 3902 Ron McFadyen4 Multivalued Dependencies Consider the relation EMP enamepnamedname EMP Note that EMP is BCNF, and there is a lot of redundancy in EMP
5
Winter 2007ACS - 3902 Ron McFadyen5 Multivalued Dependencies If (Smith, X, John) and (Smith, Y, Anna) exist, then (Smith, Y, John) and (Smith, X, Anna) exist The MVD ename pname | dname exists in EMP enamepnamedname EMP
6
Winter 2007ACS - 3902 Ron McFadyen6 Multivalued Dependencies We might have liked to have: enamepnamedname EMP SmithX, YJohn, Anna But 1NF does not permit multivalued attributes
7
Winter 2007ACS - 3902 Ron McFadyen7 Multivalued Dependencies enamepnamedname EMP SmithXJohn SmithYAnna So, instead of : enamepnamedname EMP SmithX, YJohn, Anna We have: SmithYJohn SmithXAnna
8
Winter 2007ACS - 3902 Ron McFadyen8 Decomposing a MVD Note that if X Y | Z exists, then EMP can be decomposed into (X,Y) and (R-Y) XYZ R XY Ra XZ Rb And this is a lossless decomposition Decomposing a MVD without loss of information
9
Winter 2007ACS - 3902 Ron McFadyen9 Decomposing a MVD As ename pname | dname exists, EMP can be decomposed into enamepnamedname EMP enamepname EMPa enamedname EMPb This is a lossless decomposition
10
Winter 2007ACS - 3902 Ron McFadyen10 4NF A relation R is in 4NF if and only if it is in BCNF and it does not contain any non-trivial MVDs A MVD is a trivial MVD if either Y contained in X X U Y = R A trivial MVD does not specify a useful constraint for a relation X Y | Z
11
Winter 2007ACS - 3902 Ron McFadyen11 4NF Example. Suppose we have embassies, employees, and languages Suppose that each embassy has languages that each employee must speak in order to work there: Suppose our US embassy only requires English Suppose our France embassy requires French and English Suppose John and April work at the US embassy Suppose David and Victor work at the France embassy
12
Winter 2007ACS - 3902 Ron McFadyen12 4NF works-in m n p employeeembassylanguage Employee Language Embassy Perhaps the first iteration of the design included the n-ary relationship, and the added restriction that all employees of an embassy must have each language skill of the embassy Suppose we have the relation
13
Winter 2007ACS - 3902 Ron McFadyen13 4NF Suppose our US embassy only requires English Suppose our France embassy requires French and English Suppose John and April work at the US embassy Suppose David and Victor work at the France embassy works-in employeeembassylanguage JohnFranceEnglish JohnFranceFrench AprilFranceEnglish AprilFranceFrench DavidUSEnglish VictorUSEnglish
14
Winter 2007ACS - 3902 Ron McFadyen14 4NF The works-in relation is BCNF, but not 4NF There is redundancy in the relation; there are update anomalies We can create two new 4NF relations using two projections: works-for (employee, embassy) required-for (embassy, language)
15
Winter 2007ACS - 3902 Ron McFadyen15 4NF works-for employeeembassy JohnFrance AprilFrance DavidUS VictorUS embassylanguage FranceEnglish FranceFrench USEnglish required-for Each is in 4NF There are no redundancies
16
Winter 2007ACS - 3902 Ron McFadyen16 4NF Now, we might notice that the right way to have modelled is works-for m n n Employee Embassy required-for m Language
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.