110 likes | 266 Views
Today’s class. 3NF Decomposition Multi-valued Dependencies (MVD) 4NF. Example 4 . Let R=R(A,B,C) with FDs F={ B C, ACB} Keys: {A,C}, {A,B} BC violates BCNF condition R1={B,C} with BC ({B} is the key) R2={B,A} What about ACB BCNF decomposition is not Dependency Preserving.
E N D
Today’s class 3NF Decomposition Multi-valued Dependencies (MVD) 4NF
Example 4 • Let R=R(A,B,C) with FDs F={ BC, ACB} • Keys: {A,C}, {A,B} • BC violates BCNF condition • R1={B,C} with BC ({B} is the key) • R2={B,A} • What about ACB • BCNF decomposition is not Dependency Preserving
3NF • Less stringent than BCNF • Dependency preserving at the cost of a little redundancy • A relation R is in 3NF iff every non-trivial FD X Y is such that X is either a superkey or a member of key • Example 4 satisfies 3NF condition • Since ‘B’ is a part of a key ({A,B})
Example 4 (Re-visited) • Let R=R(A,B,C) with FDs F={ BC,ACB} • Keys: {A,C}, {A,B} • BC, AC B satisfy 3NF condition • R is in 3NF • R may contain redundancy due to BC
Note • 3NF decomposition is similar to 4NF decomposition • A relation is in 4NF => it is in 3NF
Multi-valued Dependency – EX1 Consider the following relations Name Street City
Multi-valued Dependency – EX2 Consider the following relation CTB with NO FDs and the key is CTB. But with the constraint that the recommended texts for a course are independent of the instructor. CTB is in BCNF but contains redundancy
MVD • The MVD X Y is said to hold over R if, each X value is associated with a set of Y values and this set is ‘independent’ of the values in the other attributes • The MVD X Y hold over r=r(R) implies if t1, t2 R and t1.X=t2.X, then there must be some t3r such that t3.XY=t1.XY and t3.Z=t2.Z • In previous example: C T • FD restricts tuples where as MVD adds tuples • If (a, b1, c1), (a, b2, c2) r=R(X,Y,Z) then (a, b1, c2) and (a, b2, c1) must be in r
Theory of MVDs • Replication • X Y => X Y • Converse is not true • MVD complementation • If X Y, then X R-X-Y • In the given example • C T => C B • MVD transitivity • If X Y and Y Z, then X Z-Y
Note • Splitting rule does not hold for MVDs • Ex: name street city • Keys are determined using FD’s only • AB C then AB AC (i.e. adding attributes from left is okay) • A MVD X Y is non-trivial • None of Y is in X • R X Y
4NF • R is said to be in 4NF if for every non-trivial MVD X Y that holds on R, X is a superkey • Refer Example 2 • CTB is not in 4NF as CT is a nontrivial MVD and C is not a key (given CTB is the key) • 4NF decomposition • R1 (C,T) is in 4NF • R2 (C,B) is in 4NF • 4NF forbids non-trivial MVD’s unless they are actually FD’s allowed by BCNF