Download presentation
Presentation is loading. Please wait.
Published byΌφελος Παπανδρέου Modified over 6 years ago
1
Multivalued Dependencies & Fourth Normal Form
2
Functional Dependency
S b Q c W Domain (X) Range (Y)
3
Functional Dependency
Recall that if X uniquely determines Y, then Y is functionally dependent on X(X->Y) You may recall math the terms Domain and Range. The domain is the set of all values possible of X and the range is the set of all possible values of Y. The relation is a function because each of the elements of X maps exactly to one element of Y.
4
Multi valued Dependency (MVD)
Smith Jones Cooper Anna John Lila Elsa Chris Employee (X) Dependent (Y)
5
Definition of MVD A multivalued dependency on R, X ->>Y, says that if two tuples of R agree on all the attributes of X, then their components in Y may be swapped, and the result will be two tuples that are also in the relation. i.e., for each value of X, the values of Y are independent of the values of R-X-Y. Multivalued dependency is also referred as a tuple-generating dependency. The multivalued dependency also plays a role in 4NF normalization.
6
Properties of MVD If α ->> β, Then α ->> R − β
If α ->> β and δ γ , Then αδ ->> βγ If α ->> β and If β ->> γ, then α ->> γ - β A decomposition of R into (X, Y) and (X, R-Y) is a lossless-join decomposition if and only if X ->> Y holds in R.
7
Decomposition Theorem
The split of relations is guaranteed to be lossless if the intersection of the attributes of the new tables is a key of at least one of them. The join connects tuples depending on the attribute (values) in the intersection. If these values uniquely identify tuples in the other relation we do not lose information.
8
Example of lossy decomposition
Original table A B C 1 2 A C 1 2 A B 1 2 A B C 1 2 Reconstruction
9
MVD Example namephones Name beersliked name addr phones beersLiked
sue a p1 b1 sue a p2 b2 sue a p2 b1 sue a p1 b2
10
MVD Example Drinkers(name, addr, phones, beersLiked)
A drinker’s phones are independent of the beers they like. namephones and namebeersLiked. Thus, each of a drinker’s phones appears with each of the beers they like in all combinations.
11
4NF Definition A relation R is in 4NF if and only if, for every one of its non-trivial multivalued dependencies XY, X is a superkey—that is, X is either a candidate key or a superset thereof. Nontrivial MVD means that: Y is not a subset of X, and X and Y are not, together, all the attributes.
12
Decomposition into 4NF If XY is a 4NF violation for relation R, we can decompose R using the same technique as for BCNF. XY is one of the decomposed relations. All but Y – X is the other.
13
4NF Decomposition Example
Drinkers(name, addr, phones, beersLiked) FD: nameaddr MVD’s: namephones namebeersLiked Key is {name, phones, beersLiked}. All dependencies violate 4NF.
14
4NF Decomposition Example (cont.)
Decompose using nameaddr: Drinkers1(name, addr) In 4NF; only dependency is nameaddr. Drinkers2(name, phones, beersLiked) Not in 4NF. MVD’s namephones and namebeersLiked apply. No FD’s, so all three attributes form the key.
15
4NF Decomposition Example (cont.)
Decompose Drinkers2 Either MVD name ->-> phones or name ->-> beersLiked tells us to decompose to: Drinkers3(name, phones) Drinkers4(name, beersLiked)
16
Fifth Normal Form An entity is in Fifth Normal Form (5NF) if, and only if, it is in 4NF and every join dependency for the entity is a consequence of its candidate keys. A relation decompose into two relations must have the lossless-join property, which ensures that no spurious tuples are generated when relations are reunited through a natural join operation.
17
Example
18
Decomposition Redundancy can be removed, Now join these relations,
The row marked with the arrow is a spurious row.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.