1 / 16

Multivalued Dependencies and 4NF

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. Multivalued Dependencies.

lindsay
Download Presentation

Multivalued Dependencies and 4NF

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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 ACS - 3902 Ron McFadyen

  2. 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 ACS - 3902 Ron McFadyen

  3. 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 ACS - 3902 Ron McFadyen

  4. Multivalued Dependencies Consider the relation EMP EMP ename pname dname Note that EMP is BCNF, and there is a lot of redundancy in EMP ACS - 3902 Ron McFadyen

  5. Multivalued Dependencies EMP ename pname dname 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 ACS - 3902 Ron McFadyen

  6. Multivalued Dependencies We might have liked to have: EMP ename pname dname Smith X, Y John, Anna But 1NF does not permit multivalued attributes ACS - 3902 Ron McFadyen

  7. Multivalued Dependencies So, instead of : EMP ename pname dname Smith X, Y John, Anna We have: EMP ename pname dname Smith X John Smith Y Anna Smith Y John Smith X Anna ACS - 3902 Ron McFadyen

  8. Decomposing a MVD Decomposing a MVD without loss of information R X Y Z Note that if X Y | Z exists, then EMP can be decomposed into (X,Y) and (R-Y) Ra X Y X Z Rb And this is a lossless decomposition ACS - 3902 Ron McFadyen

  9. Decomposing a MVD EMP ename pname dname As ename pname | dname exists, EMP can be decomposed into EMPa ename pname This is a lossless decomposition ename dname EMPb ACS - 3902 Ron McFadyen

  10. 4NF X Y | Z • 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 • A relation R is in 4NF if and only if • it is in BCNF and • it does not contain any non-trivial MVDs ACS - 3902 Ron McFadyen

  11. 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 ACS - 3902 Ron McFadyen

  12. 4NF 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 Language n works-in Employee Embassy m p Suppose we have the relation works-in employee embassy language ACS - 3902 Ron McFadyen

  13. 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 employee embassy language John France English John France French April France English April France French David US English Victor US English ACS - 3902 Ron McFadyen

  14. 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) ACS - 3902 Ron McFadyen

  15. 4NF works-for required-for employee embassy embassy language John France France English April France France French David US US English Victor US Each is in 4NF There are no redundancies ACS - 3902 Ron McFadyen

  16. 4NF Now, we might notice that the right way to have modelled is m works-for n Employee Embassy m required-for n Language ACS - 3902 Ron McFadyen

More Related