













Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!














how (design) theory can help us achieve a better database schema ^ what the concept of functional dependencies is ^ how to check the validity of a functional dependency with respect to a table
what the
Armstrong axioms
are
what the
closure
is
how a
closure
is computed
how to determine whether a given FD is contained in the closure of a set of FDs ^
what a
canonical cover
of a set of functional dependencies is
how a
canonical cover
is computed
Although Armstrong’s axioms are complete, it is comfortable to add three furtherinference rules: −^
union rule
: If
B^ and
C^ holds, then also
holds.
decomposition rule
: If
holds, then also
B^ and
C^ holds.
pseudotransitivity rule
: If
B^ and
holds, then also
holds. ^
example: −^
supplier
relation with the schema
supplier
(sname, saddr, product, price)
Valid FDs: {sname}
{saddr}, {sname, product}
{price}, {sname}
{sname},
{sname, product}
{product}
It is to be shown: {sname, product}
{saddr} is also satisfied.
We have: {sname}
{saddr}.
Due to the augmentation rule we obtain: {sname, product}
{saddr, product}.
Due to the decomposition rule we hence obtain: {sname, product}
{saddr}.
computing the closure
repeat
for each
functional dependency
f^ in
do
apply reflexivity and augmentation rules to
add the resulting functional dependencies to
od
for each
pair of functional dependencies
f^1
and
f^2
in^ F
+^ do
if^ f
and 1
f^2
can be combined using transitivity
then
add the resulting functional dependency to
fi od
until
does not change any further
Containment of a FD in a closure
question: Let
be a set of FDs and
B^ a FD. Does
hold?
problem: explicit calculation of
is too expensive
instead: calculation of the
closure
of the attribute set
regarding the set
consists of all attributes that are functionally determined by
If^ B
holds, then also
holds.
algorithm for inferring
algorithm
AttrClosure
// input: a set
of FDs and a set
of attributes
// output: the complete set
of attributes for which holds:
repeat
OldA
foreach
do
if^ B
then
until
=^ OldA
+;^ return
Canonical cover ^
In general, distinct equivalent sets of FDs exist. Two sets
and
of FDs are called
equivalent
iff^
+^ holds.
Definition of equivalence is convincing, because the equality of the closures for
F^ and
G^ implies that the same FDs can be inferred from
and
For a given set
of FDs there exists a unique closure
drawbacks of the closure
in general very many FDs in
so that the handling with
becomes difficult
large redundant set of FDs that has to be checked as consistency tests for data-base modifications ^
goal: computation of a most possible small set of FDs which are equivalent to
less effort for testing whether a new or updated tuple violates a FD
Fc^
is called
canonical cover
of a given set
of FDs, if holds:
+Fc
In^ F
there are no FDs c^
B^ where
or^ B
contain
extraneous
attributes, i.e., they
are reduced as much as possible.We cannot omit any attribute on the
left
sides of any FD, otherwise we would
change the semantics: ∀^ a
Fc^
a })
F^ c
+
Example
schema
supplier
(sname,
saddr,
product,
price)
and
FDs
{sname, product}
{saddr} and {sname, product}
{price}. Can we omit one of
the attributes on the left sides?We cannot omit any attribute on the
right
sides of any FD, otherwise we would
change the semantics: ∀^ b
Fc^
b })})
F^ c
+
Each left side of the FDs in
Fc
occurs only once, i.e.,
if^ A
and
C^ hold, then in
Fc
only the FD
is used.
algorithm for computing the canonical cover −^
step 1: For each FD
perform a
left reduction
: check for all
a^
whether the attribute
a^ is extraneous, i.e., whether
AttrClosure
{ a
holds. If this is the case, replace
B^ by (
{ a
step 2: For each remaining FD
perform the
right reduction
: check for
all^
b^ ∈
B , whether the attribute
b^ is extraneous, i.e., whether
b^ ∈
AttrClosure
b })},
holds. If this is the case, replace
B^ by
−^ { b
step 3: Remove the FDs of the form
∅^ which perhaps have been produced in
the previous step. −^
step 4: By using the union rule replace all FDs of the form
Bn^
by
Bn
example −^
Given the set
step 1:
is replaced by
C , because
on the left side is extraneous
is already functionally dependent from
by the first two FDs).
step 2:
C^ is replaced by
∅, because
on the right side is extraneous.
This results from the fact that
⊆^ AttrClosure
step 3:
∅^ is removed. We obtain:
Fc
step 4: Nothing to be done.
-^
-^
-^
-^