Professional Documents
Culture Documents
Functional Dependencies
Functional Dependencies
Functional Dependencies
o Let and .
o Then the functional dependency holds on R if in any legal relation
r(R), for all pairs of tuples and in r such that , it is also the
case that .
o Using this notation, we say K is a superkey of R if .
o In other words, K is a superkey of R if, whenever , then
(and thus ).
2. Functional dependencies allow us to express constraints that cannot be expressed
with superkeys.
3. Consider the scheme
4. Loan-info-schema = (bname, loan#, cname, amount)
5.
if a loan may be made jointly to several people (e.g. husband and wife) then we
would not expect loan# to be a superkey. That is, there is no such dependency
loan# cname
loan# amount
loan# bname
to hold, as a loan number can only be associated with one amount and one branch.
8. We can see that is satisfied (in this particular relation), but is not.
is also satisfied.
9. Functional dependencies are called trivial if they are satisfied by all relations.
10. In general, a functional dependency is trivial if .
11. In the customer relation of figure 5.4, we see that is satisfied by
this relation. However, as in the real world two cities can have streets with the
same names (e.g. Main, Broadway, etc.), we would not include this functional
dependency in our list meant to hold on Customer-scheme.
12. The list of functional dependencies for the example database is:
o On Branch-scheme:
o bname bcity
o
o bname assets
o
o On Customer-scheme:
o cname ccity
o
o cname street
o
o On Loan-scheme:
o loan# amount
o
o loan# bname
o
o On Account-scheme:
o account# balance
o
o account# bname
o
logically implies .
7.
8. and
9. with
10. .
11.
12. Find a functional dependency
with an
13.
14. extraneous attribute in
or in .
15.
16. If an extraneous attribute is
found, delete it from
17.
18.
19. until F does not change.
20.
21. An example: for the relational scheme R=(A,B,C), and the set F of functional
dependencies
22. A BC
23.
24. B C
25.
26. A B
27.
28. AB C
29.
we will compute .