Database Design & Schema Refinement
Database Design & Schema Refinement
Schema Refinement
u
If t & u Then
agree they must
here agree
here
FD1 PK
FD2 CK
FD3
FD4
FD1 PK
FD2 CK
FD3 FD4
FD1 PK
FD2 CK
FD3
FD4
Prop# transitively determines tax_rate
through state
Prop# transitively determines price
through area
© Prof. Navneet Goyal, BITS, Pilani
3 NF
A relation that is in 1NF & 2 NF &
no non-PK attribute is transitively
dependent on the PK, is said to be
in 3 NF
Remove all
2 NF 3 NF
Transitive Dependencies
F+=F
repeat
for each functional dependency f in F+
apply reflexivity and augmentation rules on f
add the resulting functional dependencies to F +
for each pair of functional dependencies f1and f2 in F +
result := ;
while (changes to result) do
for each in F do
begin
if result then result := result
end
Try to find out why this algorithm works!
Complexity of this algorithm
Can you do any better?
S# Status S# City
1
S3 30 S3 Paris
S5 30 S5 Athens
Theorem
A decomposition of R into R1 and R2 is
lossless join wrt FDs F, if and only if at
least one of the following dependencies is
in F+:
• R1 R2 R1
• R1 R2 R2
In other words, R1 R2 forms a superkey
of either R1 or R2
AB+={ABCDE}