Function Dependenct
Function Dependenct
X →Y
X is determinant
Y is dependent
“ X determine Y ”
“Y dependent on X ”
s# city p# qty
S1 Gwl P1 100
S1 Gwl P2 100
S2 Indore P1 200
S2 Indore P2 200
S3 Indore P2 300
s# → city
(s#, p#) → qty
(s#, p#) → city
(s#, p#) → (city, qty)
(s#, p#) → s#
(s#, p#) → p#
A B C
a1 b1 c1
a1 b1 c2
a2 b1 c1
a2 b1 c3
A→B
C→B
(C, A) → B
address s# city
qty p# pdetails
pname
The above relation is not in 2nd NF because every
dependence except { s#, p#} → qty is implied by proper
subsets of P.K.
Disadvantages –
Redundancy
Update – update address of S1
Insertion – to insert S4 as a new supplier from which we have not
started purchasing.(but p# is a PK)
Deletion – if S2 is deleted, it will delete all information about city,
status (P2)
address s# city
sname
Disadvantages –
Redundancy
Update – update status of Gwl from 40 to 50
Insertion – to insert new city with no supplier
Deletion – if S3 is deleted, it will delete all information about city.
Hence,
S31( s#, sname, address, city)
S32 ( city, status)
So we break it-
R1(A, B)
R2(A, C) there is no FD
Another break-
R1(A, B)
R2(B, C) there is only one FD i.e. C → B but not AB → C
Hence BCNF is stronger as compared to 3NF.
Database System Concepts 1.43 ©Silberschatz, Korth and Sudarshan
BCNF 3NF
Lose FD Preserve FD
Reduce redundancy Tolerate some
redundancy
NOTE – FD is more important than redundancy.
Hence 3NF is preferred as compare to BCNF.
A B C
a1 b1 c1
a2 b1 c1
a3 b1 c1
a4 b2 c2
Repetition of information (i.e. relationship b1, c1)
AB+ =
b1
a1, c2 b2
b5
A B C
t1 a1 b1 c1
t2 a1 b2 c2
A -->> B | C
To avoid inconsistency.
A B C
a1 b1 c1
a1 b1 c2
a2 b1 c1
a2 b1 c3
c1
b1 -->> a1 | c1 a1 c2
b1 -->> a1 | c2 b1
b1 -->> a2 | c1 a2 c1
b1 -->> a2 | c3 c3
S# P# J#
S1 P1 J2
S1 P2 J1
S2 P1 J1
S1 P1 J1