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.

Slides:



Advertisements
Similar presentations
primary key constraint foreign key constraint
Advertisements

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 16 Relational Database Design Algorithms and Further Dependencies.
ALAK ROY. Assistant Professor Dept. of CSE NIT Agartala N ATIONAL I NSTITUTE OF T ECHNOLOGY A GARTALA Aug-Dec,2010 Normalization 2 CSE-503 :: D ATABASE.
METU Department of Computer Eng Ceng 302 Introduction to DBMS Further Dependencies by Pinar Senkul resources: mostly froom Elmasri, Navathe and other books.
1 CS 430 Database Theory Winter 2005 Lecture 9: Fourth and Fifth Normal Forms.
Chapter 3 Notes. 3.1 Functional Dependencies A functional dependency is a statement that – two tuples of a relation that agree on some particular set.
4 TH NORMAL FORM & Lossless Decomposition By: Karen McVay CS 157B.
Multivalued Dependency Prof. Sin-Min Lee Department of Computer Science.
Copyright © 2004 Pearson Education, Inc.. Chapter 11 Relational Database Design Algorithms and Further Dependencies.
Multivalued Dependency Prof. Sin-Min Lee Department of Computer Science.
Winter 2002Arthur Keller – CS 1804–1 Schedule Today: Jan. 15 (T) u Normal Forms, Multivalued Dependencies. u Read Sections Assignment 1 due. Jan.
4 TH NORMAL FORM By: Karen McVay. REVIEW OF NFs 1NF  All values of the columns are atomic. That is, they contain no repeating values. 1NF  All values.
MVDs: 1 Join Dependencies—Example Let r = A B C = A B |  | A C 1 a x 1 a 1 x 1 a y 1 b 1 y 1 b x 2 a 2 y 1 b y 2 b 2 a y 2 b y Observe: r =  AB r | 
Winter 2007ACS Ron McFadyen1 4NF works-in employeeembassylanguage Now, what happens if the ternary relationship works-in means something else: consider.
Normalization II. Boyce–Codd Normal Form (BCNF) Based on functional dependencies that take into account all candidate keys in a relation, however BCNF.
Chapter 14 Advanced Normalization Transparencies © Pearson Education Limited 1995, 2005.
Chapter 11 Relational Database Design Algorithms and Further Dependencies Copyright © 2004 Ramez Elmasri and Shamkant Navathe.
Introduction to Schema Refinement
Normalization B Database Systems Normal Forms Wilhelm Steinbuss Room G1.25, ext. 4041
Normalization Amit Bhawnani & Nimesh Shah. What is normalization We need some formal measure of why one grouping of attributes into a relational schema.
Functional Dependencies
Normalization Goal = BCNF = Boyce-Codd Normal Form = all FD’s follow from the fact “key  everything.” Formally, R is in BCNF if for every nontrivial FD.
Copyright © Curt Hill Schema Refinement III 4 th NF and 5 th NF.
Lecture 6 Normalization: Advanced forms. Objectives How inference rules can identify a set of all functional dependencies for a relation. How Inference.
DatabaseIM ISU1 Chapter 10 Functional Dependencies and Normalization for RDBs Fundamentals of Database Systems.
CS143 Review: Normalization Theory Q: Is it a good table design? We can start with an ER diagram or with a large relation that contain a sample of the.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide DESIGNING A SET OF RELATIONS (2) Goals: Lossless join property (a must). Dependency.
Further Normalization I
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 11 Relational Database Design Algorithms and Further Dependencies.
Relational Database Design Algorithms and Further Dependencies.
Chapter 11: Relational Database Design Algorithms and Further Dependencies Chapter 11: Relational Database Design Algorithms and Further Dependencies 1.
Design Process - Where are we?
Chapter :- 3 Database Designing.
Normalization.
3 Spring Chapter Normalization of Database Tables.
CS 405G: Introduction to Database Systems Instructor: Jinze Liu Fall 2009.
Multivalued Dependencies Fourth Normal Form Tony Palladino 157B.
Multivalued Dependencies and 4th NF CIS 4301 Lecture Notes Lecture /21/2006.
CS 338Database Design and Normal Forms9-1 Database Design and Normal Forms Lecture Topics Measuring the quality of a schema Schema design with normalization.
Ch 7: Normalization-Part 1
Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D.
11/10/2009GAK1 Normalization. 11/10/2009GAK2 Learning Objectives Definition of normalization and its purpose in database design Types of normal forms.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Relational Database Design Algorithms and Further Dependencies.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Chapter 14 Functional Dependencies and Normalization Informal Design Guidelines for Relational Databases –Semantics of the Relation Attributes –Redundant.
4NF & MULTIVALUED DEPENDENCY By Kristina Miguel. Review  Superkey – a set of attributes which will uniquely identify each tuple in a relation  Candidate.
4TH NORMAL FORM By: Karen McVay.
Normalization Database Management Systems, 3rd ed., Ramakrishnan and Gehrke, Chapter 19.
Functional Dependency and Normalization
Advanced Normalization
Chapter 15 Relational Design Algorithms and Further Dependencies
CHAPTER 14 Basics of Functional Dependencies and Normalization for Relational Databases.
Schedule Today: Next After that Normal Forms. Section 3.6.
Higher Forms of Normalization
Functional Dependencies and Normalization for RDBs
Schedule Today: Jan. 23 (wed) Week of Jan 28
Advanced Normalization
Normal forms First Normal Form (1NF) Second Normal Form (2NF)
Schema Refinement and Normal Forms
Problems in Designing Schema
Relational Design Theory
Fourth normal form: 4NF.
Normalization Murali Mani.
Multivalued Dependencies & Fourth Normal Form
Multivalued Dependencies & Fourth Normal Form
Normalization.
Relational Design Theory
Decomposition and Higher Forms of Normalization
Chapter Outline 1 Informal Design Guidelines for Relational Databases
Presentation transcript:

Winter 2007ACS 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

Winter 2007ACS 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

Winter 2007ACS 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

Winter 2007ACS Ron McFadyen4 Multivalued Dependencies Consider the relation EMP enamepnamedname EMP Note that EMP is BCNF, and there is a lot of redundancy in EMP

Winter 2007ACS 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

Winter 2007ACS Ron McFadyen6 Multivalued Dependencies We might have liked to have: enamepnamedname EMP SmithX, YJohn, Anna But 1NF does not permit multivalued attributes

Winter 2007ACS Ron McFadyen7 Multivalued Dependencies enamepnamedname EMP SmithXJohn SmithYAnna So, instead of : enamepnamedname EMP SmithX, YJohn, Anna We have: SmithYJohn SmithXAnna

Winter 2007ACS 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

Winter 2007ACS 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

Winter 2007ACS 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

Winter 2007ACS 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

Winter 2007ACS 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

Winter 2007ACS 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

Winter 2007ACS 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)

Winter 2007ACS Ron McFadyen15 4NF works-for employeeembassy JohnFrance AprilFrance DavidUS VictorUS embassylanguage FranceEnglish FranceFrench USEnglish required-for Each is in 4NF There are no redundancies

Winter 2007ACS 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