Upload
sobhan-dasari
View
221
Download
0
Embed Size (px)
Citation preview
8/10/2019 26CS157F_Ha Do - Multivalued Dependency
1/14
8/10/2019 26CS157F_Ha Do - Multivalued Dependency
2/14
Functional Dependency
b
c
4
Q
$
Domain (X) Range (Y)
a
8/10/2019 26CS157F_Ha Do - Multivalued Dependency
3/14
Functional Dependency
Recall that if X uniquely determines Y, then Y isfunctionally dependent on X.
You may recall math the terms Domain andRange. The domain is the set of all valuespossible of X and the range is the set of allpossible values of Y.
The relation is a function because each of theelements of X maps exactly to one element of Y.
8/10/2019 26CS157F_Ha Do - Multivalued Dependency
4/14
Multivalued Dependency
Smith
Jones
Cooper
Anna
John
Lila
Elsa
ChrisEmployee (X)
Dependent (Y)
8/10/2019 26CS157F_Ha Do - Multivalued Dependency
5/14
Definition of MVD A multivalued dependency is a full constraint between two sets of attributes in a relation.
In contrast to the functional independency , themultivalued dependency requires that certaintuples be present in a relation. Therefore, amultivalued dependency is also referred as a
tuple-generating dependency. The multivalueddependency also plays a role in 4NFnormalization.
8/10/2019 26CS157F_Ha Do - Multivalued Dependency
6/14
full constraint A constraint which expresses somethingabout all attributes in a database. (In contraryto an embedded constraint .) That amultivalued dependency is a full constraint
follows from its definition, where it sayssomething about the attributes R .
tuple-generating dependency A dependency which explicitly requires certaintuples to be present in the relation.
8/10/2019 26CS157F_Ha Do - Multivalued Dependency
7/14
A Formal Definition
Let R be a relation schema and let and . Themultivalued dependency ->> holds on R if,in any legal relation r (R ), for all pairs of tuples t 1
and t 2 in r such that t 1[] = t 2[], there existtuples t 3 and t 4 in r such thatt 1[] = t 2[] = t 3[] = t 4[] t 3[] = t 1[] t 3[R ] = t 2[R ] t 4[] = t 2[] t 4[R ] = t 1[R ]
8/10/2019 26CS157F_Ha Do - Multivalued Dependency
8/14
Definition of MVD (cont.)
A multivalued dependency on R , X ->>Y , saysthat if two tuples of R agree on all the attributesof X , then their components in Y may be
swapped, and the result will be two tuples thatare also in the relation.
i.e., for each value of X , the values of Y areindependent of the values of R - X -Y .
8/10/2019 26CS157F_Ha Do - Multivalued Dependency
9/14
Tuples Implied by name->->phones
If we have tuples:
name addr phones beersLikedsue a p1 b1sue a p2 b2sue a p2 b1sue a p1 b2
Then these tuples must also be in the relation .
8/10/2019 26CS157F_Ha Do - Multivalued Dependency
10/14
Example
Here is possible data satisfying these MVDs:
name areaCode phone beersLiked manfSue 650 555-1111 Bud A.B.Sue 650 555-1111 WickedAle Petes Sue 415 555-9999 Bud A.B.Sue 415 555-9999 WickedAle Petes
But we cannot swap area codes or phones by themselves.That is, neither name->->areaCode nor name->->phoneholds for this relation.
8/10/2019 26CS157F_Ha Do - Multivalued Dependency
11/14
Properties of MVD
f ->> , Then ->> R If ->> and , Then ->> If ->> and If ->> , then ->> -
The following also involve functional dependencies:If ->> , then ->> If -> and -> , then ->
A decomposition of R into (X, Y) and (X, R-Y) is alossless-join decomposition if and only if X ->> Yholds in R.
http://en.wikipedia.org/w/index.php?title=Lossless-join_decomposition&action=edithttp://en.wikipedia.org/w/index.php?title=Lossless-join_decomposition&action=edithttp://en.wikipedia.org/w/index.php?title=Lossless-join_decomposition&action=edithttp://en.wikipedia.org/w/index.php?title=Lossless-join_decomposition&action=edithttp://en.wikipedia.org/wiki/Image:Twoheadrightarrow.gif8/10/2019 26CS157F_Ha Do - Multivalued Dependency
12/14
Decomposition Theorem
The split of relations is guaranteed to belossless if the intersection of the attributesof the new tables is a key of at least one ofthem.
The join connects tuples depending on theattribute (values) in the intersection. Ifthese values uniquely identify tuples in theother relation we do not lose information.
8/10/2019 26CS157F_Ha Do - Multivalued Dependency
13/14
Example of lossy decomposition
A B C1 1 11 1 21 2 1
A B C
1 1 11 1 21 2 1
1 2 2
A B
1 1
1 2
A C
1 1
1 2
Original table Decomposition
Reconstruction
8/10/2019 26CS157F_Ha Do - Multivalued Dependency
14/14
References
Silberschatz, Korth, Sudarshan. DatabaseSystem Concepts , 5th Editionhttp://en.wikipedia.org/wiki/Multivalued_dependency http://www.stanford.edu/~ullman/dscb/pslides/mvds.ppthttp://www.cs.sjsu.edu/faculty/lee/cs157/cs157a.html
http://en.wikipedia.org/wiki/Multivalued_dependencyhttp://en.wikipedia.org/wiki/Multivalued_dependencyhttp://en.wikipedia.org/wiki/Multivalued_dependencyhttp://en.wikipedia.org/wiki/Multivalued_dependency