You are on page 1of 52

UNI

T–I
V
DATABASEDESI
GNTHEORYANDNORMALI
ZATI
ON

I
ntr
oduct
ionTOSchemaRef
inement
Concept
ualdat
abase desi
gn gi
ves us a setofr
elat
ion schemas and
i
ntegr
it
yconst
rai
nts(
ICs)t
hatcanber
egar
dedasagoodst
art
ingpoi
ntf
or
t
hef
inaldat
abasedesi
gn.Thi
sini
ti
aldesi
gnmustber
efi
nedbyt
aki
ngt
he
I
Csi
ntoaccountandal
sobyconsi
der
ingper
for
mancecr
it
eri
aandt
ypi
cal
wor
kloads.

Amaj
orai
m ofr
elat
ionaldat
abasedesi
gni
stomi
nimi
zedat
aredundancy
.
Thepr
obl
emsassoci
atedwi
thdat
aredundancyar
eil
l
ust
rat
edasf
oll
ows:

Pr
obl
emscausedbyr
edundancy

St
ori
ngt
hesamei
nfor
mat
ioni
nmor
ethanonepl
acewi
thi
nadat
abasei
s
edr
cal
l edundancyandcanl
eadt
osev
eral
probl
ems:

 RedundantSt
orage:
Somei
nfor
mat
ioni
sst
oredr
epeat
edl
y.

 Updat
eAnomal
i
es:I
fonecopyofsuchr
epeat
eddat
aisupdat
ed,an
i
nconsi
stencyi
scr
eat
edunl
essal
lcopi
esar
esi
mil
arl
yupdat
ed.

I
nser
ti
on Anomal
i
es:I
t may not be possi
blet
o st
ore cer
tai
n
i
nfor
mat
ionunl
esssomeot
her
,unr
elat
ed,i
nfor
mat
ioni
sst
oredas
wel
l
.

 Del
eti
on Anomal
i
es:I
tmay notbe possi
blet
o del
ete cer
tai
n
i
nfor
mat
ionwi
thoutl
osi
ngsomeot
her
,unr
elat
ed,
inf
ormat
ionaswel
l
.

Ex:Consi
derar
elat
ion,Hour
ly_ ssn,name,l
Emps( ot,r
ati
ng,hour
ly_
wages,
hour
s_wor
ked)

1
Thekeyf
orHour
ly_ sssn.I
Empsi naddi
ti
on,
supposet hehour
hatt ly_
wages
at
tri
but
eisdet
ermi her
nedbyt ati
ngat
tri
but
e.Thati
s,f
oragi
venr
ati
ng
v
alue,t
her
eisonl
yoneper
missi
ble hour
ly_
wages v
alue.Thi
sICi
san
eofaf
exampl unct
ionaldependency
.Itl
eadst
opossi
bler
edundancyi
nthe
r
elat
ionHour
ly_
Emps,
asshownbel
ow:

name hour
ly_
wage hour
s_wor
ke
Ssn l
ot r
ati
n s d
g
567 Adi
thy
a 48 8 10 40
576 Dev
esh 22 8 10 30
574 Ay
ush 35 5 7 30
Soni
597 Raj
asekha 35 5 7 32
r
5c1 Suni
l 35 8 10 40

I
fthesamev
alueappear
si her
nt ati
ngcol
umnoft
wot
upl
es,
theI
Ctel
l
sus
t
hatt
hesamev
aluemustappeari
nthehour
ly_
wagescol
umnaswel
l
.Thi
s
r
edundancyhast
hef
oll
owi
ngpr
obl
ems:

 Redundant St
orage: The r
ati
ng v
alue 8 cor
responds t
o t
he
hour
ly_
wage10,
andt
hisassoci
ati
oni
srepeat
edt
hreet
imes.

 Updat
e Anomal
i
es:The hour
ly_
wage i
nthe f
ir
stt
upl
e coul
d be
updat
edwi
thoutmaki
ngasi
mil
archangei
nthesecondt
upl
e.

I
nser
ti
onAnomal
i
es:Wecannoti
nser
tat
upl
eforanempl
oyeeunl
ess
hehour
weknowt ly_
wagef
ort
heempl
oy sr
ee’ at
ingv
alue.

2
 Del
eti
onAnomal
i
es:I
fwedel
eteal
ltupl
eswi
thagi
venr
ati
ngv
alue
(
e.g.
,wedel
etet
het
upl
esf
orAy
ushSoniandRaj
asekhar
)wel
oset
he
associ
ati
onbet hatr
weent ati
ngv
alueandi
tshour
ly_
wagev
alue.

1.I
NFORMALDESI
GNGUI
DELI
NESFORRELATI
ONALSCHEMA

1.
Semant
icsoft
heAt
tr
ibut
es
2.
Reduci
ngt
heRedundantVal
uei
nTupl
es.
3.
Reduci
ngNul
lval
uesi
nTupl
es.
4.
Dissal
l
owi
ngspur
iousTupl
es.
1.
1Semant
icsoft
heAt
tri
but
es
Wheneverwearegoi
ngt of
ormr elat
ionalschemather
eshould
besomemeani ngamongtheat t
ri
butes.Thismeani
ngiscall
ed
semant
ics.
Thissemant
icsrel
atesoneat tr
ibut
etoanotherwi
th
somerelat
ion.

Eg:
STUDENT
SNO St
udentname Sem

STUDENTt
abl
ehav
etoal
l
owal
lat
tr
ibut
esr
elat
edt
ost
udentonl
y
1.
2.Reduci
ngt
heRedundantVal
uei
nTupl
es
Mixi
ngattri
but
esofmult
ipl
eent
iti
esmaycauseprobl
ems
I
nformati
onisstor
edr
edundant
lywast
ingst
orageProbl
emswi
th
updateanomali
es
I
nser
ti
onanomal
i
es
Del
eti
onanomal
i
es
Modi
fi
cat
ionanomal
i
e

3
Eg:
STUDENT
SNO St
udentname Sem

Eg:
DEPARTMENT
Dept
No DeptName

4
I
fwei
ntegr
atet
heset
woandi
susedasasi
ngl
etabl
ei.
eSt
udentTabl
e

Student
USNNo name Sem DeptNo DeptName

Herewhenev
erifweinsertthetupl
estheremaybe‘N’stunentsi
n
onedepar
tment,soDeptNo,DeptNamev aluesar
erepeated‘N’
ti
meswhichleadstodataredundancy
.
Anot
herpr
obl
em i
supdat
aanamol
i
esi
eifwei
nser
tnewdeptt
hathas
nost
udent
s.
I
fwedelet
ethelaststudentofadept
,t
henwhol
einf
ormat
ionabout
t
hatdepar
tmentwill
bedel et
ed
I
fwechangetheval
ueofoneoftheattr
ibutesofapar
ti
caul
art
abl
e
thewemustupdat
ethetupl
esofallt
hestudentsbel
ongi
ngtot
het
deptel
seDat
abasewil
lbecomeinconsi
stent.
1.
3.Reduci
ngNul
lval
uesi
nTupl
es.
Attr
ibut
esthatar
eNULLfrequent
lycoul
dbepl
acedi
nsepar
ate
r
elat
ions(wi
ththepr
imar
ykey )
Reasonsf
ornul
l
s:
i
)at
tri
but
enotappl
i
cabl
eori
nval
i
d
i
i
)at
tri
but
eval
ueunknown(
mayexi
st)

5
i
i
i)v
alueknownt
oexi
st,
butunav
ail
abl
e

1.
4.Di
sal
l
owi
ngspur
iousTupl
es
t
heset
upl
esar
ecr
eat
edwhenwej
oint
wot
abl
es
Baddesignsforarelat
ional
databasemayr esul
tinerr
oneous
resul
tsf
orcertainJOINoperat
ionsThe"lossl
essjoi
n"proper
tyi
s
usedtoguaranteemeaningful
result
sforjoi
noperati
ons
2)FUNCTI
ONALDEPENDENCI
ES

Af
unct
ional
dependency(
FD)i
saki
ndofI
Cthatgener
ali
zest
heconceptof
akey
.

LetRbear
elat
ionschemaandl
etXandYbenonempt
yset
sofat
tri
but
es
i
nR.Wesayt
hatani
nst
ancerofRsat
isf
iest
heFDX→Yi
fthef
oll
owi
ng
hol
dsf
orev
erypai
roft
upl
est
1andt
2inr
:

I
ft1.
X=t
2.X,
thent
1.Y=t
2.Y.

AnFDX→Ysay
sthati
ftwot
upl
esagr
eeont
hev
aluesi
nat
tri
but
esX,
they
mustal
soagr
eeont
hev
aluesi
nat
tr
ibut
esY.

Ex:
TheFDAB→Ci
ssat
isf
iedbyt
hef
oll
owi
ngi
nst
ance:

A B C D

a1 b1 c1 d1

a1 b1 c1 d2

a1 b2 c2 d1

a2 b1 c3 d1

6
Her
e,i
fweaddat
upl
e<a1,
b1,
c2,
d1>t
othei
nst
anceshowni
nfi
gur
e,t
he
r
esul
ti
ngi
nst
ancewoul
dvi
olat
etheFD.

Reasoni
ngaboutFDs

Gi
venasetofFDsov
erar
elat
ionschemaR,
typi
cal
l
ysev
eral
addi
ti
onal
FDs
hol
dov
erRwhenev
eral
loft
hegi
venFDshol
d.

Ex:
Consi
derWor
ker
s(ssn,
name,
lot
,di
d,si
nce)

Wi
thgi
venFDsssn→ di
danddi
d→ l
ot.Then,i
nanyl
egali
nst
anceof
Wor
ker
s,i
ftwot
upl
eshav
ethesamessnv
alue,t
heymusthav
ethesame
di
dval
ue,andbecauset
heyhav
ethesamedi
dval
ue,t
heymustal
sohav
e
hesamel
t otv
alue.Ther
efor
e,heFDssn→ l
t otal
sohol
dsonWor
ker
s.

Cl
osur
eofaSetofFDs

Thesetofal
lFDsi
mpl
i
edbyagi
vensetFofFDsi
scal
l
edt
hecl
osur
eofF,
edasF+.
denot

Ex1:

Consi
derar
elat
ionschemaABCwi
thFDsA→BandB→C.

Fr
om t
ransi
ti
vi
ty,
wegetA→C.

Fr
om augment
ati
on,
wegetAC→BC,
AB→AC,
AB→CB.

Ex2:

Cont
ract
s(cont
ract
id,
suppl
i
eri
d,pr
oject
id,
dept
id,
par
ti
d,qt
y,v
alue)

Wedenot
etheschemaf
orCont
r sasCSJDPQV.
act

Thef
oll
owi
ngar
ethegi
venFDs:

i
) C→ CSJDPQV.
7
i
i
) JP→C.

i
i
i) SD→P.

Sev
eral
addi
ti
onal
FDshol
dint
hecl
osur
eoft
hesetofgi
venFDs:

om JP→CandC→CSJDPQV,
Fr andt
ransi
ti
vi
ty,
wei
nferJP→CSJDPQV.

om SD→Pandaugment
Fr ati
on,
wei
nferSDJ→ JP.

om SDJ→JP,
Fr JP→CSJDPQV,
andt
ransi
ti
vi
ty,
wei
nferSDJ→CSJDPQV.

At
tri
but
eCl
osur
e

I
fwewantt
ocheckwhet
heragi
vendependency
,say
,X→Y,i
sint
he
cl e F+,we can do so ef
osur fi
cient
lywi
thoutcomput
ing F+.We f
ir
st
comput
etheat
tri
but
ecl
osur
eX+wi
thr
espectt
oF,whi
chi
sthesetof
at
tri
but
esAsucht
hatX→Acanbei
nfer
redusi
ngAr
mst
rongAxi
oms.The
al
gor
it
hm f
orcomput
ingt
heat
tr
ibut
ecl
osur
eofasetXofat
tri
but
esi
s
shownbel
ow:

cl
osur
e=X;

r
epeatunt
ilt
her
eisnochange:
{

i
fther
eisanFDU→Vi
nFsucht
hatUЄcl
osur
e,

hensetcl
t osur
e=cl
osur
eUV

I
NFERENCERULES

(
1)Ref
lexi
ve:
If‘
B’i
sasubsetof‘
A’t
henal
way
s‘A’
candet
ermi
ne‘
B’

(
2)Augment
ati
on:
If t
hen

8
(
3)Tr
ansi
ti
ve:
If and Ct
hen
(
4)Uni
on:
Iti
sappl
i
edf
ort
heLHSat
tr
ibut
esi
.e.
,I
f , t
hen

(
5)Decomposi
ti
on:
If t
henwecanwr
it
eitas and
(
6)Composi
ti
on:
If and t
hen,
(
7)Sel
fdet
ermi
nat
ion: ,
1Q Fi
ndt
headdi
ti
onal
F.D’
sder
ivedf
rom F1wher
easetofF.
D’sf
rom
semant
ics.

F2=

Byt
ransi
ti
ver
ule, f
rom (
1)&(
2)

Byuni
onr
ule, f
rom (
4)&(
5)

Byt
ransi
ti
ver
ule, f
rom (
7)&(
8)

CLOSURESETOFATTRI
BUTES

Al
gor
it
hm usedt
oident
if
ythecl
osur
esetofat
tri
but
es:

(
1)Let‘
X’beasetofat
tr
ibut
est
hatwi
l
lbecomet
hecl
osur
e.
(
2)Repeat
edl
ysear
chf
oraF.
Dwher
etheLHSofF.
Disapar
tof‘
X’t
hen
addRHSoft
heF.
Dto‘
X’i
sal
readynotav
ail
abl
e.
(
3)Repeatst
ep(
2)asmanyt
imesasnecessar
yunt
ilnomor
eat
tri
but
es

9
canbeaddedt
o‘X’
.
(
4)Theset‘
X’af
ternomor
eat
tr
ibut
escanbeaddedt
o‘X’
wil
lbecomea
cl
osur
eset
.
PROBLEMS:

Appl
i
cat
ionsofcl
osur
esetofat
tri
but
es:

(
1)Toi
dent
if
ytheaddi
ti
onal
F.D’
s.
(
2)Toi
dent
if
ythekey
s.
(
3)Toi
dent
if
ytheequi
val
encesoft
heF.
D’s
(
4)Toi
dent
if
yir
reduci
blesetofF.
D’sorcanoni
cal
for
msofF.
D’sor
st
andar
dfor
m ofF.
D’s.
2Q Consi
derar
elat
ionABCDEFGandFDsar
e

Ans:X=AC

=ACB

=ABCDE

=ABCDE

3Q Fort
her
elat
ionR(
ABCDE)andFDsar
e

10
Ans:X=B
=BD
B+=BD

ndAB+
Fi
X=AB
=ABC
=ABCD
=ABCDE

=ABCDE

ndCD+
Fi
X =CD
=CDE
=ACDE
=ABCDE

=ABCDE

4Q Forar
elat
ionR(
ABCDEF)andFDsar
e

11
ndAB+
Ans:Fi

X=AB
=ABC
=ABCD
=ABCDE

=ABCDE

(
1) I
dent
if
yingt
headdi
ti
onal
F.D’
s
TocheckanyF.
D’sl
i
ke canbedet
ermi
nedf
rom F1ornot
.

Compl
eteA+f
r sA+i
om F1i ncl
udesBal
sot
hen, canbeder
ived
asaF.
DinF2.

Q5 Check canbeder
ivedf
rom F1

F1:

12
i
. D A
X=D
=DE
D+=DE
D Ai
.e.Cannotbedet
ermi
neA
i
i
. AB D
X=AB
=ABC
=ABCD
AB+=ABCD
i
i
i. AB F
X=AB
=ABC
=ABCD
=ABCDE
AB+=ABCDE
AB cannotbedet
ermi
neF

Q6 Fi
ndBCD Hcanbeder
ivedf
rom F1

F1:

13
Sol
:

i
. X=BCD
=BCDE
=BCDEH
=BCDEAH
BCD+=BCDEAH
BCD H

(
ii
) ABC H
X=ABC
ABC H
(
2)I
dent
if
icat
ionofkeybyusi
ngcl
osur
esetasat
tri
but
es

(
i)Apr
imar
ykey
(
ii
)Composi
tepr
imar
yey
(
ii
i) Candi
dat
ekey
s
(
iv) For
eignkey
s
(
v)Sur
rogat
ekey
(
vi) Superkey
Max.
no.
ofFor
eignkey
s=1024.

Akeyat
tri
but
e:Anat
tri
but
ethati
scapabl
eofi
dent
if
yingal
lot
herat
tri
but
es
i
nagi
vent
abl
e.

(
i)Pr
imar
ykey
:
I
tisanuni
quev
alueat
tr
ibut
einat
abl
etoenf
orceent
it
y

14
i
ntegr
it
yandt
iident
if
yrowsi
nthet
abl
euni
quel
y.

(
ii
)Composi
tePr
imar
yKey
:
Somet
imessi
ngl
eat
tr
ibut
eisnotsuf
fi
ci
entt
oident
if
yuni
quel
ythe
r
owsi
nthet
abl
eso,
wecombi
ne2ormor
eat
tri
but
est
oident
if
ythe
r
owsuni
quel
y.

(
ii
i) Candi
dat
ekey
s:
Somet
imes2ormor
eindependentat
tri
but
eorat
tri
but
escanbeused
t
oident
if
yther
owsuni
quel
yEg:
(vechno,
vengno,
pur
chasedat
e)

Ei
therv
ehi
clenoorv
ehi
cleengi
nenocanbeusedasakeyat
tri
but
e
t
hent
heyar
ecal
l
edascandi
dat
ekey
soneoft
hecandi
dat
ekeycan
beel
ect
edaspr
imar
ykey
.

(
iv) Sur
rogat
ekey
:
Somet
imesev
eni
fyoucombi
neal
ltheat
tri
but
esi
nthet
abl
ethey
maynothav
euni
quev
alues.

Toi
dent
if
yther
owsuni
quel
ywewi
l
luseasy
stem gener
atedkey
cal
l
edassur
rogat
ekey
.

(
v)For
eignkey
:
I
tisusedt
oenf
orcer
efer
ent
ial
int
egr
it
yandanat
tri
but
einat
abl
ecan
becal
l
edasaf
orei
gnkeyat
tr
ibut
ethatr
eferpr
imar
ykeyi
nsameor
di
ff
erentt
abl
e.

Q1 I
fR(
ABCDEH)andFDsar
e

15
Fi
ndkey
s?

Superkey
=ABCDEH

Nowf
indA¬+=ABC

E+=EC

D+=DAEH

=ABCDEH

Di
skey

I
fthecl
osur
eofanyoft
heLHSat
tri
but
esar
ecombi
nat
ionsof
t
heLHSat
tr
ibut
esi
ncl
udesal
ltheat
tri
but
esi
nthet
abl
ethen
t
hatwi
l
lbecomeakeyi
nthet
abl
e.
 At
abl
ecanhav
e2ormor
ekey
s.
Q2 Consi
derar
elat
ionwi
thf
iveat
tri
but
esABCDEandFDsar
e

Li
stal
lkey
sforR.

Sol
:Superkey
:ABCDE

A¬+=AB X

16
BC+=BCE X
ED+=ABDEX
A¬B+=AB X
A¬C+=ABCE X
BD+=BD X
A¬BC+=ABCE
BCD+=BCDEA
A¬CD+=ABCDE
CDE+=ADEBC
Q3 R(
ABCDE)&FDsar
e

Li
stal
lkey
sforR.

Sol
:Superkey
=ABCDE

A¬B+=ABC
CD+=CDE
DE+=DEB
A¬BC+=ABC
A¬BD+=ABDCE
A¬BE+=ABEC
A¬CD+=ACDEB
ABD&ACDar
ekey
s

17
Q4 R(
ABCDEGGHI
J)&FDsar
e

Li
stal
lkey
sforR

Not
e:

Somet
imesal
ltheat
tr
ibut
esi
nthet
abl
emaynotappeari
nF.
D’s

Eg:
D Imaybeav
ail
abl
einst
eadofD I
J

AB+=ABCDEFGHI
J

Thekeyf
ort
her
elat
ionR=ABJt
hemi
ssi
ngat
tri
but
esf
rom t
heF.
D’s
mustbeat
tachedt
othecl
osur
e.

Q5R(
ABCDEFGHI
J)&FDsar
e

Li
stal
lkey
sforR

Sol
:

Superkey
=ABDH

A¬B+=ABC X
BD+=BDEF X

18
AD+=ADGHI
J X
A¬BD+=ABDCEFGHI
J
A¬BH+=ABHCI
J X
A¬BD+=ABCDEFGHI
J

(
3)Toi
dent
if
yequi
val
enceofF.
D

Di
ff
erentdat
abasedesi
gner
smaydef
inedi
ff
erentF.
D’sset
sfr
om t
he
samer
equi
rement
s.Toev
aluat
ewhet
hert
heyar
eequi
val
enti
fwear
e
abl
etoder
iveal
lF.
D’si
nGf
rom Fandv
ice-
ver
sa.

Q1 Consi
dert
hef
oll
owi
ngt
woset
sofFDs

F=

G=

Fi
ndt
heequi
val
enceoft
woset
sofFDs.

St
ep1:
TakesetFandencl
oseal
lFD’
sinGt
hatcanbeder
ivedf
rom F.

A+f
rom F

X=A
=AC
=ACD

19
E+f
rom F

X=E
=EAD
=EADH

St
ep2:
TakesetGandencl
oseal
lF.
D’si
nFt
hatcanbeder
ivedf
rom G.

A+f
rom G

X=A
=ACD

X=AC
=ACD

X=E
=EAH
=EAHCD

F Gso,
Gispr
efer
abl
easi
tcont
ainsl
essFDs.

Q2 Consi
dert
woset
sofFDsont
heat
tri
but
esABCDE

20
F=

G=

Fi
ndwhet
hert
heyar
eequi
val
entornot

Sol
:

St
ep1:

B+f
rom F

X=B
=BCDA
=ABCDE
Al
lFD’
sar
eder
ivabl
efr
om F.
St
ep2:

B+f
rom G

X=B
=BCDE
=ABCDE
Al
lFD’
sar
eder
ivabl
efr
om G.
F G
Fi
spr
efer
abl
e
21
Noofdependenci
esar
eless.

(
4) Toi
dent
if
ythei
rr
educi
blef
orm ofFD’
s/canoni
cal
For
m

OnceF1i
sident
if
iedf
rom t
hesemant
icsandF2i
sder
ivedf
rom F1we
gett
otal
F.D’
si.
eFbutbef
oremaki
ngamov
etot
henor
mal
i
zat
ion
pr
ocesswi
thF,
Fmustbeev
aluat
edf
orr
edundantat
tri
but
eont
heLHS
andRHSofF.
D’sandi
tisaf
ourst
eppr
ocess.

St
ep1:
Hav
esi
ngl
eat
tr
ibut
esont
heRHSf
orev
eryFD.

St
ep2:
Eval
uat
eal
lF.
D’si
nst
ep1f
ort
hei
rnecessi
ty.I
ftheyar
enot
necessar
y,r
emov
ethem f
rom t
hel
i
st.

St
ep3:
Eval
uat
ethenecessi
tyoft
heRHSat
tri
but
esi
nFD’
sobt
ainedf
rom
st
ep2.
Ift
heyar
enotnecessar
yremov
efr
om FD.

St
ep4:
Appl
ytheuni
onr
ulef
orcommont
oLHSat
tri
but
eint
heFD’
s
obt
ainedf
rom st
ep3.
Thenwewi
l
lgeti
rr
educi
bleset
.

Ty
pesoff
unct
ional
Dependenci
es:

(
1)Par
ti
alF.
D
(
2)Tr
ansi
ti
veF.
D
(
3)Ful
lF.
D.

1.Par
ti
alF.
D:Adependencyi
nwhi
chnon-
keyat
tri
but
esar
epar
ti
all
y
dependi
ngonkeyat
tr
ibut
es.
R=ABCD

F=AB C

22
=B D

Key
:ABbutBi
sdependi
ngonl
yDt
her
efor
eB Di
sconsi
der
edas
par
ti
aldependency

Undert
hef
oll
owi
ngcondi
ti
onsat
abl
ecannothav
epar
ti
alF.
D

(
1)I
fpr
imar
ykeyconsi
stsasi
ngl
eat
tri
but
e
(
2)I
ftabl
econsi
stsonl
ytwoat
tri
but
es
(
3)I
fal
ltheat
tr
ibut
esi
nthet
abl
ear
epar
toft
hepr
imar
ykey
.
2.Tr
ansi
ti
veF.
D:Adependencyi
nwhi
cht
her
eisar
elat
ionshi
pamong
t
henon-
keyat
tr
ibut
es.

Eg:
R=ABCD

F:
AB C

AB D

C D

Key
=AB

C dI
sat
ransi
ti
vedependencyandi
tcausesi
nser
ti
on,
del
eti
on&
updat
ionpr
obl
emsi
nthet
abl
e.

Undert
hef
oll
owi
ngCi
rcumst
ances,
atabl
ecannothav
etr
ansi
ti
veF.
D

(
1)I
ftabl
econsi
stsonl
ytwoat
tri
but
es
(
2)I
fal
ltheat
tr
ibut
esi
nthet
abl
ear
epar
toft
hepr
imar
ykey
.

23
3.Ful
lF.
D:AdependencyX Yi
sconsi
der
edasaf
ull
F.Di
fther
emov
al
ofanyat
tri
but
efr
om XmakesX Yasi
nval
i
dF.
D

Eg:
AB CD

B CDX

 AB CDi
saf
ull
F.D

NORMALI
ZATI
ON

I
tist
hepr
ocessofr
educi
ngt
her
edundancybasedonpr
imar
ykey
s
andF.
D
OR
I
tisat
ool
tov
ali
dat
eorev
aluat
ethel
ogi
cal
dat
abasedesi
gnwi
tht
he
hel
pofr
uleswhi
char
ecal
l
edasNor
mal
For
ms.Theyar
e

1NF
2NF
3NF
BCNF Pr
obl
em i
ntensi
tyr
educesandno.oft
abl
esneededwi
l
lbe
i
ncr
eased.
4NF
5NF
Adv
ant
ages:

(
1)Dat
abaseconsi
stencycanbeachi
eved

24
(
2)I
tincr
easest
hespeed(
Byel
i
minat
ingt
hedupl
i
cat
es)
(
3)I
treducest
hedi
sksi
ze
(
4)I
tmai
ntai
nst
hei
ntegr
it
y.

25
3)Nor
mal
for
msbasedonpr
imar
ykey
s:
Dat
abaseNor
mal
i
zat
ioni
sat
echni
queofor
gani
zi
ngt
hedat
aint
he
dat
abase.Nor
mal
i
zat
ioni
sasy
stemat
icappr
oachofdecomposi
ngt
abl
es
t
oel
i
minat
edat
aredundancy
(repet
it
ion)andundesi
rabl
echar
act
eri
sti
cs
l
i
keI
nser
ti
on,
Updat
eandDel
eti
onAnomal
i
es.I
tisamul
ti
-st
eppr
ocess
t
hatput
sdat
aint
otabul
arf
orm,
remov
ingdupl
i
cat
eddat
afr
om t
her
elat
ion
t
abl
es.

Nor
mal
i
zat
ioni
susedf
ormai
nlyt
wopur
poses,

 El
i
minat
ingr
edundant
(usel
ess)dat
a.
 Ensur
ingdat
adependenci
esmakesensei
.edat
aisl
ogi
cal
l
yst
ored.

Pr
act
ical
UseofNor
mal
For
ms
Mostpr
act
ical
desi
gnpr
oject
sacqui
reexi
sti
ngdesi
gnsofdat
abasesf
rom
pr
evi
ousdesi
gns,
desi
gnsi
nlegacymodel
s,orf
rom exi
sti
ngf
il
es.
Nor
mal
i
zat
ioni
scar
ri
ed
outi
npr
act
icesot
hatt
her
esul
ti
ngdesi
gnsar
eofhi
ghqual
i
tyandmeett
he
desi
rabl
epr
oper
ti
esst
atedpr
evi
ousl
y.

3.
1Fi
rstNor
mal
For
m(1NF)

 Thecel
l
soft
het
abl
emusthav
esi
ngl
eat
omi
cval
ue
 Nei
therr
epeat
inggr
oupsnorar
ray
sar
eal
l
owedasv
alues
 Al
lent
ri
esi
nanycol
umn(
att
ri
but
e)mustbeoft
hesameki
nd
 Eachcol
umnmusthav
eauni
quename,
butt
heor
deroft
hecol
umns
i
nthet
abl
eisi
nsi
gni
fi
cant
.

26
 Not
wor
owsi
nat
abl
emaybei
dent
ical
andt
heor
derofr
owsi
s
i
nsi
gni
fi
cant
Exampl
e:
i
)DLOCATI
ONv
iol
ati
ngt
her
ulesor
emov
eandpl
acewi
thsepar
ater
elat
ion
asDept
-Locat
ionwi
thpr
imar
ykey
i
i
)DEPTr
epl
acet
hel
ocat
ionat
tr
ibut
eby3at
omi
cval
ues
Dl
ocat
ion1,
Dlocat
ion2,
Dlocat
ion3
i
i
i)(
Dnumber
,Dl
ocat
ion)combi
nat
ionaspr
imar
ykey

3.
2SecondNor
mal
For
m
Secondnor
mal
for
m(2NF)i
sbasedont
heconceptoff
ull
funct
ional
dependency
.
 At
abl
eissai
dtobei
n2NFi
fiti
sal
readyi
nthe1NFandNonpr
ime
at
tr
ibut
esar
eful
lfunct
ional
l
ydependentonakey

27
 Anomal
i
escanoccurwhenat
tr
ibut
esar
edependentononl
ypar
tofa
mul
ti
-at
tri
but
ekey
.
 Ar
elat
ioni
sinsecondnor
mal
for
m whenal
lnon-
keyat
tri
but
esar
e
dependentont
hewhol
ekey
.
Exampl
e
 Thet
estf
or2NFi
nvol
vest
est
ingf
orf
unct
ional
dependenci
eswhose
l
eft
-handsi
de
 TheEMP_
PROJr
elat
ioni
sin1NFbuti
snoti
n2NF.
 Thenonpr
imeat
tr
ibut
eEnamev
iol
ates2NFbecauseofFD2,
asdo
t
henonpr
imeat
tr
ibut
esPnameandPl
ocat
ionbecauseofFD3.
 Thef
unct
ional
dependenci
esFD2andFD3makeEname,
Pname,
and
Pl
ocat
ionpar
ti
all
ydependentont
hepr
imar
ykey{
Ssn,
Pnumber
}of
EMP_
PROJ,
thusv
iol
ati
ngt
he2NFt
est
.
I
far
elat
ionschemai
snoti
n2NF,
itcanbesecondnor
mal
i
zedor2NF
nor
mal
i
zed
i
ntoanumberof2NFr
elat
ionsi
nwhi
chnonpr
imeat
tri
but
esar
e
associ
atedonl
y
 Ther
efor
e,t
hef
unct
ional
dependenci
esFD1,
FD2,
andFD3i
nFi
gur
e
l
eadt
othedecomposi
ti
onofEMP_
PROJi
ntot
het
hreer
elat
ion
schemasEP1,
EP2,
andEP3

i
nFi
gur
e15.
11(
a),
eachofwhi
chi
sin2NF.

28
3.
3Thi
rdNor
mal
For
m
Thi
rdnor
mal
for
m(3NF)i heconceptoft
sbasedont ransi
ti
vedependency
.
At
abl
eissai
dtobei
ntheThi
rdNor
mal
For
m when,

1.I
tisi
ntheSecondNor
mal
for
m.
2.And,
itdoesn'
thav
eTr
ansi
ti
veDependency
3.AndX-
>yi
sar
elat
iont
henei
therxi
ssuperkeyoryi
spr
imeat
tri
but
e

Exampl
e:

 Ther
elat
ionschemaEMP_
DEPTi
nFi
gur
e15.
3(a)i
sin2NF,
sinceno
par
ti
aldependenci
esonakeyexi
st.
 EMP_
DEPTi
snoti
n3NFbecauseoft
het
ransi
ti
vedependencyof
Dmgr
_ssn(
andal
soDname)onSsnv
iaDnumber
.
 Wecannor
mal
i
zeEMP_
DEPTbydecomposi
ngi
tint
othet
wo3NF
r
elat
ionschemasED1andED2

29
Pr
obl
emson2NFAND3NF:

Q1Consi
deruni
ver
sal
rel
ati
onR=ABCDEFGHI
Jandt
hesetofFDsar
e

F=AB C
A DE
B F
F GH
D I
J

Whati
sthekeyf
orR?DecomposeRi
nto2NF

Sol
:key
=AB
AB=CDEFGHI
J

St
ep1:
A B C D E F G H I J

Or

A+=ADEI
J

30
B+=BFGH

I
fther
eisapar
ti
aldependency
,remov
epar
ti
all
ydependentat
tri
but
esf
rom
t
heor
igi
nal
tabl
eandpl
acei
tinasepar
atet
abl
eal
ongwi
tht
hecopyofi
ts
det
ermi
nant
.

(
a)Key =AB
(
b)A+=ADEI
J
B+=BFGH

DEI
J-dependi
ngonl
yonA

FGH-
dependi
ngonl
yonB

(
c) R=ABC

Requi
red2NF

Q2Consi
dert
her
elat
ionR=ABCDEFandsetofFDsar
e
F=A FC
C D
B E
Fi
ndt
hekeyandnor
mal
i
zei
nto2NF
Sol
:

(
a)Key
=AB
(
b)A+=ACDF
B+=BE

31
(
c) R=AB
Requr
ied2NF

Q3Consi
dert
her
elat
ionR=ABCDE.Fi
ndt
hekeyandnor
mal
i
zeupt
o2NF

F=B E
C D
A B
Sol
:
(A)KEY=AC
B)A+=ABE
(
C+=CD
(
C)R=A

Requi
red2NF

Q4Consi
derR=ABCDEFGHI
JandFDsar
e

F=AB C
BD EF
AD GH
A I
H J
Fi
ndt
hekeyandnor
mal
i
zeupt
o2NF

32
Sol
:(A)Key
=ABD
B)AB+=ABCI
(
BD+=BDEF
AD+=ADGHI
J

(
C)R1=ABCI A+=AI R11=AI
B+=B R111=ABC

R2=BDEF B+=B R2=BDEF


D+=D
J A+=AI
R3=ADGHI R31=AI
D+=D R311=ADGHJ

R4=ABD

Q1Consi
deruni
ver
sal
rel
ati
onR=ABCDEFGHI
Jandt
hesetofFDsar
e
F=AB C
A DE
B F
F GH
D I
J
DecomposeRi
nto3NF

Tr
ansi
ti
veD I
JADEI
J
DI
J
ADE
BFGH FGH

33
BP
ABC ABC

Q2Consi
dert
her
elat
ionR=ABCDEFandsetofFDsar
e
F=A FC
C D
B E
Nor
mal
i
zeRi
nto3NF
ACDF CD
ACF
BE BE
AB

Q3Consi
dert
her
elat
ionR=ABCDE.Fi
ndt
hekeyandnor
mal
i
zeupt
o3NF

F=B E
C D

34
A B

R¬1=ABE BE
AB
R2=CD CD
R3=AC AC

Q4Consi
derR=ABCDEFGHI
JandFDsar
e

F=AB C
BD EF
AD GH
A I
H J
Nor
mal
i
zeupt
o3NF
R¬1=AI
R2=ABC
R3=BDEF
R4=ADGHJ HJ
ADG
R5=ABD

35
4.Boy
ce-
coddNor
mal
for
m(BCNF)
:
Ar
elat
ionschemaRi
sinBCNFi eranont
fwhenev ri
vi
alf
unct
ional
dependencyX→Ahol nR,
dsi thenXi keyofR.
sasuper
Boy
ce-
Coddnor
mal
for
m(BCNF)waspr
oposedasasi
mpl
erf
orm of3NF,
buti
twasf
oundt
obest
ri
ctert
han3NF.
Thati
s,ev
eryr
elat
ioni
nBCNFi
sal
soi
n3NF,
butr
elat
ioni snot
n3NFi
necessar
il
yinBCNF.

Exampl
e:LOTSr
elat
ionschema
 Fi
gur
e15.
12(
a)wi
thi
tsf
ourf
unct
ional
dependenci
esFD1t
hrough
FD4.
 Supposet
hatwehav
ethousandsofl
otsi
nther
elat
ionbutt
hel
ots
ar
efr
om onl
ytwocount
iesI
ndi
aandchi
na
l
otsi
zesi
nindi
aCount
yar
eonl
y0.
5,0.
6,0.
7,0.
8,0.
9,and1.
0acr
es
 wher
easl
otsi
zesi
nchi
naCount
yar
erest
ri
ctedt
o1.
1,1.
2,.
..
,1.
9,and
2.
0acr
es.
I
nsuchasi
tuat
ionwewoul
dhav
etheaddi
ti
onal
funct
ional
 dependencyFD5:
Area→Count
y_name.her
eCount
y_namei
sapr
ime
at
tr
ibut
e.

36
I
nourexampl
e,FD5v
iol
atesBCNFi
nLOTS1AbecauseAREAi
snota
super
keyofLOTS1AbutFD5sat
isf
ies3NFbecauseCount
y_namei
s
apr
imeat
tri
but
e
 WecandecomposeLOTS1Ai
ntot
woBCNFr
elat
ionsLOTS1AXand
LOTS1AY,
Thi
sdecomposi
ti
onl
osest
hef
unct
ional
dependencyFD2

Pr
obl
emsonBCNF:

Al
gor
it
hm:

St
ep1:
comput
eX+

St
ep2:
repl
acer
elat
ion‘
R’byt
hef
oll
owi
ngdecomposedr
elat
ions

i
)R1=X+

i
i
)R2=R-
(X+-X)

Exampl
e:consi
dert
her
elat
ionR(
ABC)ANDNor
mal
i
zei
tint
oBCNF

F:
AB-
>C

B-
>C

37
Sol
:AB+=ABC

B+=BC

Key
=AB

Her
eAB-
>Ci
sal
readyi
nBCNFbecauseABi
ssuper
keysonowsol
veonl
yB
-
>C

st
ep1:
comput
ex+

X=B

X+=B+

B+=BC

R1=BC

St
ep2:
her
ewehav
e2subpar
ts

i
)R1=X+=BC

I
ii
)R2=R-
(X+-
X)

=ABC-
(BC-
B)

=ABC-
C

R2=AB

Requi
redBCNF=AB

BC

Exampl
e2:

Consi
dert
her
elat
ionR(
ABCDEF)andnor
mal
i
xei
ntoBCNF

38
F:
AB-
>C

C-
>DE

D-
>F

5.Mul
ti
-Val
uedDependency(
MVD)and4NF

Repr
esent
sadependencybet
weenat
tr
ibut
es(
forexampl
e,A,
B,andC)i
na
r
elat
ion,

Condi
ti
ons:

1.f
oreachv
alueofAt
her
eisasetofv
aluesf
orBandasetofv
aluesf
orC.

2.t
hesetofv
aluesf
orBandCar
eindependentofeachot
her
.

Wer
epr
esentanMVDbet
weenat
tr
ibut
esA,
B,andCi
nar
elat
ionusi
ngt
he
f
oll
owi
ngnot
ati
on:

A→→ B

A→→ C

Forexampl
e,wespeci
fyt
heMVDi
nt eEmpl
heabov oyeer
elat
ionasf
oll
ows:

EmpNum →→ EmpPhone

EmpNum →→ EmpDegr
ees

Exampl
e2:

Cours
Book Lect
urer
e

39
Sil
ber
scha
AHA JohnD
tz

AHA Neder
pel
t JohnD

Sil
ber
scha
AHA Wi
l
li
am M
tz

AHA Neder
pel
t Wi
l
li
am M

 
ther
ear
etwomul
ti
val
ueddependenci
esi
nthi
srel
ati
on:{
cour
se}
 --
>{book}
and

{
cour
se}
--> 
{l
ect
urer
}.

Ar
mst
rongAxi
omsr
ulesr
elat
etoMVDs:

 MVDCompl
ement
ati
on:
IfX→→Y,
thenX→→R─XY.

 MVD Augment
ati
on:I
fX→→Y and W be supersetofZ,t
hen
WX→→YZ.

 MVDTr
ansi
ti
vi
ty:
IfX→→YandY→→Z,
thenX→→(
Z─Y)
.

Tr
ivi
alMVD:

AnMVDA→→Bi
nrel
ati
onRi
sdef
i ngt
nedasbei ri
vi
ali
f,

a)Bi
sasubsetofAor

40
b)AUB=R.

AnMVDi
ssai
dtobenon-
tr
ivi
ali
fnei
thera)norb)i
ssat
isf
ied.

Four
thNor
mal
For
m(4NF)
:

Rul
esf
or4t
hNor
mal
For
m
Forat
abl
etosat
isf
ytheFour
thNor
mal
For
m,i
tshoul
dsat
isf
ythe
fol
l
owi
ngtwocondi
ti
ons:

1.I
tshoul
dbei
nthe 
Boy
ce-
CoddNor
mal
For
m.
2.And,
thet
abl
eshoul
dnothav
eany
 Mul
ti
-val
uedDependencyot
her
t
hancandi
dat
ekey

Ex
ampl
e
Bel
owwehav eacoll
egeenrol
mentt
abl
ewi
th
col
umns 
s_i
d, 
cour
se and 
hobby.

s_
id Cour
se Hobby

1 Sci
ence Cr
icket

1 Mat
hs Hockey

2 C# Cr
icket

2 Php Hockey

Asyoucanseei
nthetabl
eabov
e,st
udentwi
th 
s_i
d 1 
hasoptedfort
wo
cour
ses,
 
Sci
ence 
and 
Maths,
andhastwohobbi
es,
 Cri
cket
 and 
Hockey.

41
4NFdecomposi
ti
on
Tomaketheaboverel
ati
onsat
if
ythe4t
hnor
mal
for
m,wecandecompose
thet
abl
eint
o2t abl
es.
Cour
seOpt
edTabl
e

s_
id Cour
se

1 Sci
ence

1 Mat
hs

2 C#

2 Php

And,
 
Hobbi
esTabl
e,

s_
id Hobby

1 Cr
icket

1 Hockey

2 Cr
icket

2 Hockey

Nowt
hisr
elat
ionsat
isf
iest
hef
our
thnor
mal
for
m.

6.Joi
ndependencyand5NF:

42
Joi
ndependency
:

Def
ini
ti
on.Aj
oindependency(
JD)
,denot R1,
edbyJD( R2,
..
.Rn)
, ,speci
fi
ed
on
r
elat
ionschemaR,
speci
fi
esaconst
rai
ntont
hest
atesrofR.The
const
rai
nt
st
atest
hatev
eryl
egal
st erofRshoul
at dhav
eanonaddi
ti
vej
oin
decomposi
ti
on
i
ntoR1,
R2,
..
.Rn.Hence,
, forev
erysuchrwehav
e

JD∗( πR1(r)
,πR2(r
),.
..
, πRn(r
))=r
Exampl e:
Student(sno,
sname,accno,bal)
Project
ionss1=(sno,sname, accno)
Project
ions2=(accno,bal)

I
fweperformjoi
nbet
weenallt
heproj
ecti
onst
henwehavetogetthe
or
igi
nal
relat
iont
henwecal
ledther
elat
ionasl
ossl
essj
oindependency
.

5NF(
or)pr
ojectnor
mal
for
m:

Ar
elat
ionRi
sin5NFi
fandonl
yifev
eryj
oindependencyi
nRi
simpl
i
edby
t
hecandi
dat
ekey
sofR.Ar
elat
iondecomposedi
ntot
wor
elat
ionsmust
hav
eloss-
lessj
oinPr
oper
ty,
whi
chensur
est
hatnospur
iousorext
rat
upl
es
ar
egener
ated,
whenr
elat
ionsar
ereuni
tedt
hroughanat
ural
joi
n.

Pr
oper
ti
es– 
Arel
ati
onRi
sin5NFi
fandonl
yifi
tsat
isf
iesf
oll
owi
ng
condi
ti
ons:
1.Rshoul
dbeal
readyi
n4NF.
2.I
tcannotbef
urt
hernonl
ossdecomposed(
joi
ndependency
)

43
 
Consi
dert
heabov
eschema,
wit
hacaseas“
ifacompanymakesapr
oduct
andanagenti
sanagentf
ort
hatcompany
,thenheal
way
ssel
l
sthat
pr
oductf
ort
hecompany
”.Undert
heseci
rcumst
ances,
theACPt
abl
eis
shownas:

Tabl
e– 
ACP

AGENT COMPANY PRODUCT

A1 PQR Nut

A1 PQR Bol
t

A1 XYZ Nut

A1 XYZ Bol
t

A2 PQR Nut

Therel
ati
onACPisagaindecomposei
nto3r
elat
ions.Now,
thenat
ural
Joi
n
ofal
lthethr
eer
elat
ionswil
lbeshownas:

Tabl
e– 
R1

AGENT COMPANY

44
AGENT COMPANY

A1 PQR

A1 XYZ

A2 PQR

Tabl
e– 
R2

AGENT PRODUCT

A1 Nut

A1 Bol
t

A2 Nut

Tabl
e– 
R3

COMPANY PRODUCT

45
COMPANY PRODUCT

PQR Nut

PQR Bol
t

XYZ Nut

XYZ Bol
t

Resul
tofNat
ural
Joi
nofR1andR3ov
er‘
Company
’andt
henNat
ural
Joi
n
ofR13andR2ov
er‘
Agent
’and‘
Product
’wi
l
lbet
abl
e ACP.
Hence,
int
hisexampl
e,al
lther
edundanci
esar
eel
i
minat
ed,
andt
he
decomposi
ti
onofACPi
sal
ossl
essj
oindecomposi
ti
on.Ther
efor
e,t
he
r
elat
ioni
sin5NFasi
tdoesnotv
iol
atet
hepr
oper
tyof
 l
ossl
essj
oin.

7.Pr
oper
ti
esofr
elat
ional
decomposi
ti
ons:

Lossl
essj
oinpr
oper
tyanddependencypr
eser
ving:
I
nagooddat
abasedesi
gn,
iti
snotonl
ysuf
fi
ci
entt
ocheckwhet
her
t
abl
esar
esat
isf
ying2NF,
3NF&BCNFbutal
socheckwhet
her
decomposedt
abl
esar
esat
isf
yingt
hef
oll
owi
ngt
wopr
oper
ti
es.
(
1)Lossl
essj
oinPr
oper
ty(
mandat
ory
)
(
2)DependencyPr
eser
vingPr
oper
ty(
opt
ional
)
7.
1Lossl
essj
oinPr
oper
ty:

46
Adecomposi
ti
onofRi
ntoR1,
R2,
R3,
…..
Rni
ssai
dtoal
ossl
ess
decomposi
ti
oni
fthenat
ural
joi
ntofal
lthepr
oject
ionsofRmustgi
ve

t
heor
igi
nal
rel
ati
oni
.eR= suppose,
if

t
hendecomposi
ti
oni
ssai
dtobel
ossy
decomposi
ti
on.

Exampl
e:
R:
A B C

a1 b1 c1

a2 b2 c2

a3 b1 c3

R1
A B

a1 b1

a2 b2

a3 b1

R2
B C

b1 c1

47
b2 c2

b1 c3

A B C

a1 b1 c1

a1 b1 c3

a2 b2 c2

a3 b1 c1

a3 b1 c3

5r
ows

Lossydecomposi
ti
on

Theabov
emet
hodi
sat
imeconsumi
ngander
rorpr
onet
her
efor
e,t
ocheck
t
hel
ossl
essj
ointpr
oper
tyweuset
hef
oll
owi
ngshor
tcutmet
hod.

i
.e,
Ift
hecommoncol
umnb/
wther
elat
ionconsi
stsuni
quev
alue(
onl
y
pr
imar
ykeywi
l
lwi
l
lhav
euni
quev
alues)t
hent
hedecomposi
ti
onwi
l
l
becomel
ossl
essot
her
wisei
tisal
ossydecomposi
ti
on.

7.
2Dependencypr
eser
vingpr
oper
ty:

Decomposi
ti
onofRi
ntoR1,
R2,
R3,
…..
Rni
ssai
dtobeadependency
+ +
pr
eser
vingdecomposi
ti
oni
f,
(F1,
F2.
..
..
..
..
Fn)=F wher
eF1i
sthesetofF.
D’si
n
R1,
F2i
sthesetofF.
D’si
nR2andsoonandFi
sthesetofF.
D’si
nR.

48
Eg1:
consi
derat
abl
econsi
stsR=ABCDat
tri
but
est
henF=A B,
A C,
C
Di
sdecomposedi
ntoR1(
ABC)
,R2(
CD)
.f
indwhet
hert
hisdecomposi
ti
oni
s
sat
isf
yingl
ossl
essj
oinanddependencypr
eser
vingpr
oper
ty.

Sol
: R1(
ABC)

R2(
CD)

I
tisal
ossl
essdecomposi
ti
onanddependencypr
eser
vingr
elat
ion.

A B(
R1)

A C(
R1)

C D(
R2)

I
fthet
abl
eisdecomposedl
i
keR1(
ABD)
,R2(
BC)i
tisal
ossydecomposi
ti
on

I
tisal
sonotadependencypr
eser
vingr
elat
ion

Exampl
e2:

(
1)R=ABCD

A D
C A
B C
Sol
:
(
a)Key
=b
(
b)Atpr
esentA,
B,C,
Donei
n2NF
(
c)BACD
(
2)B C

49
D A

Sol
:

(
a)Key
=BD
(
b)1NF
(
c)2NF=BC,
DA,
BD
3NF=BC,
DA,
BD

(
d)BCNF=BC,
DA,
BD
BCD DA

Lossl
essdecomposi
ti
on.

(
1)ABC D
D A

Sol
:

(
a)Key
=ABC,
BCD
(
b)l
etkey
=ABC
3NF

(
c)BCNF=ABC
SuperkeyABC D

D A

BCD,
DA(
butABCwi
l
lnotbeakey
)

8.Lossyandl
ossl
esswi
thexampl
e

50
Lossl
essDecomposi
ti
on
Decomposi
ti
onislossl
essifiti
sfeasi
blet
oreconstr
uctrel
ationRf rom decomposed
t
ablesusi
ngJoins.Thi
sisthepref
err
edchoi
ce.Theinfor
mationwi l
lnotlosefr
om the
rel
ati
onwhendecomposed.Thejoi
nwouldr
esul
tinthesameor igi
nalr
elat
ion.
Letusseeanexampl
e:
<EmpI
nfo>
Emp_
ID Emp_
Name Emp_
Age Emp_
Locat
ion Dept
_ID Dept
_Name

E001 Jacob 29 Al
abama Dpt
1 Oper
ati
ons

E002 Henr
y 32 Al
abama Dpt
2 HR

E003 Tom 22 Texas Dpt


3 Fi
nance

Decomposet
heabov
etabl
eint
otwot
abl
es:
<EmpDet
ail
s>
Emp_
ID Emp_
Name Emp_
Age Emp_
Locat
ion

E001 Jacob 29 Al
abama

E002 Henr
y 32 Al
abama

E003 Tom 22 Texas

<Dept
Det
ail
s>
Dept
_ID Emp_
ID Dept
_Name

Dpt
1 E001 Oper
ati
ons

Dpt
2 E002 HR

Dpt
3 E003 Fi
nance

Now,
Nat
ural
Joi
nisappl
i
edont
heabov
etwot
abl
es:
Ther
esul
twi
l
lbe:
Emp_
ID Emp_
Name Emp_
Age Emp_
Locat
ion Dept
_ID Dept
_Name

E001 Jacob 29 Al
abama Dpt
1 Oper
ati
ons

E002 Henr
y 32 Al
abama Dpt
2 HR

E003 Tom 22 Texas Dpt


3 Fi
nance

51
Ther
efor
e,t
heabov
erel
ati
onhadl
ossl
essdecomposi
ti
oni
.e.nol
ossofi
nfor
mat
ion.
LossyDecomposi
ti
on
Ast henamesuggests,whenarel
ati
onisdecomposedi
ntotwoormorerelat
ional
schemas,t
hel
ossofinfor
mati
oni
sunavoi
dabl
ewhentheor
igi
nal
rel
ati
oni
sret
ri
eved.
Letusseeanexampl
e:
<EmpI
nfo>
Emp_
ID Emp_
Name Emp_
Age Emp_
Locat
ion Dept
_ID Dept
_Name

E001 Jacob 29 Al
abama Dpt
1 Oper
ati
ons

E002 Henr
y 32 Al
abama Dpt
2 HR

E003 Tom 22 Texas Dpt


3 Fi
nance

Decomposet
heabov
etabl
eint
otwot
abl
es:
<EmpDet
ail
s>
Emp_
ID Emp_
Name Emp_
Age Emp_
Locat
ion

E001 Jacob 29 Al
abama

E002 Henr
y 32 Al
abama

E003 Tom 22 Texas

<Dept
Det
ail
s>
Dept
_ID Dept
_Name

Dpt
1 Oper
ati
ons

Dpt
2 HR

Dpt
3 Fi
nance

Now,y ou won’
t be ablet
ojoi
nthe abov
etabl
es,si
nce 
Emp_
ID 
i
sn’
t par
t of
t
he Dept
Detai
l
s r
elat
ion.
Ther
efor
e,t
heabov
erel
ati
onhasl
ossydecomposi
ti
on

52

You might also like