0% found this document useful (0 votes)
39 views

Database Normalization

The document discusses database normalization, which is the process of evaluating and modifying table structures to minimize data redundancies and anomalies. It covers the concepts of first normal form (1NF), second normal form (2NF), and third normal form (3NF). The steps to normalize a database from a user's view of information to 1NF, 2NF and 3NF are explained. An example of a project management database is used to illustrate the normalization process. Normalizing the database into higher normal forms eliminates anomalies and improves the overall design.

Uploaded by

nitotalib
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views

Database Normalization

The document discusses database normalization, which is the process of evaluating and modifying table structures to minimize data redundancies and anomalies. It covers the concepts of first normal form (1NF), second normal form (2NF), and third normal form (3NF). The steps to normalize a database from a user's view of information to 1NF, 2NF and 3NF are explained. An example of a project management database is used to illustrate the normalization process. Normalizing the database into higher normal forms eliminates anomalies and improves the overall design.

Uploaded by

nitotalib
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

N O R M A L IZ AT IO N

O F RE L AT IO N A L DATA B A S E S
MIT 202 – Adv a n c e d D ata b a s e M a n a g e m e n t Sys te m
Mr. Jos e p h S. Joa q u in
O b je ctive s
At the end of this top ic , stu d e n ts will be able to:
• D e te rm in e the ste p s on how to con v e rt use r ’s vie w
of info rm a tio n to a rela tio n a l data b a s e ; and
• C re a te a rela tio n a l data b a s e usin g the prin c ip le s of
norm a liz a tio n .
G u id e Qu estion s
• H o w to cre a te a rela tio n a l data b a s e fro m use r ’s
vie w of info rm a tio n ?
W h a t is Norm a liza tio n ?
N o rm a liz a tio n is the pro c e s s of eva lu a tin g and
corre c tin g tab le stru c tu re s to m in im iz e data
red u n d a n c ie s and to elim in a te ano m a lie s in add in g ,
upd a tin g , and dele tio n of rec o rd s .
No rm al Fo rm s
• 1N F (Firs t N o rm a l Form )
• 2N F (S e c o n d N o rm a l Fo rm )
• 3N F (Th ird N o rm a l Form )
• B C N F (B o y c e -C o d d N o rm a l Form )
Le ve ls of No rm al Fo rm s
2N F is bette r tha n 1N F and 3N F is m u c h bette r tha n
1N F and 2N F.

M o s t bus in e s s -re la te d data b a s e s use d as the hig h e s t


lev e l in norm a liz a tio n pro c e s s .
Exam p le of User ’s View of
Info rm a tio n
N o te : E xa m in e the follo w in g exa m p le as you r
refe re n c e in norm a liz a tio n pro c e d u re .
First No rm al Fo rm
To con v e rt use r ’s vie w of info rm a tio n to 1N F,
rep e a tin g gro u p s m u s t be elim in a te d w h ile deriv in g
its nam e from gro u p of m u ltip le entrie s tha t m a y exis t
in any sin g le key attrib u te .

R e la tio n a l tab le m u s t not con ta in rep e a tin g gro u p s


and norm a liz in g the tab le stru c tu re will red u c e data
red u n d a n c ie s .
First No rm al Fo rm (Continued)

Thre e -s te p pro c e d u re :
• Ste p 1 – Elim in a te R e p e a tin g Gro u p s
• Ste p 2 – Ide n tify the Prim a ry K e y s
• Ste p 3 – Ide n tify All D e p e n d e n c ie s
First No rm al Fo rm (Continued)

For Ste p 1, pre s e n t data in a tab u la r form a t, w h e re


eac h cell has a sin g le valu e and the re are no
rep e a tin g gro u p s .

Elim in a te rep e a tin g gro u p s by rem o v in g nulls to


m a k e sure tha t eac h rep e a tin g gro u p attrib u te
con ta in s an app ro p ria te data valu e .
First No rm al Fo rm (Continued)

E xa m p le
First No rm al Fo rm (Continued)

For Ste p 2, ide n tify the prim a ry key s tha t uniq u e ly


ide n tify an attrib u te valu e .

For Ste p 3, ide n tify the pos s ib le fun c tio n a l


dep e n d e n c ie s thro u g h a dep e n d e n c y dia g ra m .
First No rm al Fo rm (Continued)

E xa m p le

The arro w s abo v e the attrib u te s indic a te des ira b le


dep e n d e n c ie s , tho s e that are base d on the prim a ry key and the
arro w s belo w the attrib u te s indica te less des ira b le
dep e n d e n c ie s .
First No rm al Fo rm (Continued)

P a rtia l dep e n d e n c ie s are dep e n d e n t on prim a ry key


w h ile tra n s itiv e dep e n d e n c ie s are dep e n d e n c ie s of
one non -p rim e attrib u te on ano th e r non -p rim e
attrib u te tha t can pro d u c e data ano m a lie s .

Fun c tio n a l D e p e n d e n c y

PRO J _ N U M + EM P _ N U M  PRO J _ N A M E , EM P _ N A M E , JO B _ C L A S S , CHG _ H O U R S ,


HO U R S

P a rtia l D e p e n d e n c y

PR O J _ N U M  PR O J _ N A M E
EM P _ N U M  EM P _ N A M E , JO B _ C L A S S , CH G _ H O U R
First No rm al Fo rm (Continued)

Tra n s itiv e D e p e n d e n c y

JO B _ C LA S S  C H G _H O U R
First No rm al Fo rm (Continued)

The tab le is in 1N F if:


• All key attrib u te s has bee n defin e d ;
• The re is no rep e a tin g gro u p s in the tab le ; and
• All attrib u te s are de p e n d e n t on prim a ry key

A n d the 1N F dep e n d e n c y dia g ra m sho w s tha t all


rela tio n a l tab le s satis fy the 1N F req u ire m e n ts .
First No rm al Fo rm (Continued)

Ta b le s con ta in partia l de p e n d e n c ie s tha t are :


• D e p e n d e n c ie s bas e d on only part of the prim a ry
key ;
• D e p e n d e n c ie s use d for perfo rm a n c e rea s o n s bu t
with cau tio n s ; and
• D e p e n d e n c ie s w h ic h are sub je c t to red u n d a n c ie s .
Secon d No rm a l Form
The des ig n of rela tio n a l data b a s e can be im p ro v e d
by con v e rtin g the 1N F to 2N F.

Ste p s to con v e rt 1N F to 2N F :
• Ste p 1. Ide n tify All K e y C o m p o n e n ts
• Ste p 2. Ide n tify the D ep e n d e n t Attrib u te s
Secon d No rm a l Form (Continued)

For Ste p 1, to ide n tify the key com p o n e n ts , write


eac h key on a sep a ra te line and write the orig in a l
(co m p o s ite ) key on las t line .

E xa m p le :

• PRO J_N U M
• EMP_N U M
• PRO J_N U M , EMP _N U M

Note : This key com p o n e n t will be used on its corre sp o n d in g table .


Secon d No rm a l Form (Continued)

For Ste p 2, to ide n tify the dep e n d e n t attrib u te s , from


1N F D e p e n d e n c y Dia g ra m , dete rm in e w hic h
attrib u te s are dep e n d e n t on oth e r attrib u te s .

E xa m p le

• P R O J E C T (P R O J _ N U M , P R O J _ N A M E )
• E M P L O Y E E (E M P _ N U M , E M P _ N A M E , JO B _ C L A S S ,
CHG _H O U R S )
• AS S IG N (P R O J _ N U M , E M P _ N U M , A S S IG N _ H O U R S )
Secon d No rm a l Form (Continued)

2N F D e p e n d e n c y Dia g ra m
Secon d No rm a l Form (Continued)

The tab le is in 2N F if:


• It is in 1N F ; and
• The re is no partia l dep e n d e n c y and no attrib u te is
dep e n d e n t on only a po rtio n of the prim a ry key.
Th ird No rm al Form
D a ta ano m a lie s in any raw sou rc e are elim in a te d by
con v e rtin g 2N F des ig n to 3N F.

Ste p s to con v e rt 2N F to 3N F :
• Ste p 1. Ide n tify E ac h N e w D e te rm in a n t;
• Ste p 2. Ide n tify the D ep e n d e n t Attrib u te s ; and
• Ste p 3. R e m o v e the dep e n d e n t attrib u te s from
tran s itiv e dep e n d e n c ie s .
Th ird No rm al Form (Continued)

For Ste p 1, to ide n tify a new dete rm in a n t, w rite the


dete rm in a n t of tran s itiv e dep e n d e n c y as the prim a ry
key of the new tab le (de te rm in a n t is an attrib u te
w h o s e valu e de te rm in e s oth e r valu e s with in a row ).

For Ste p 2, ide n tify the dep e n d e n t attrib u te s of


dete rm in a n t ide n tifie d in Ste p 1.

E xa m p le

• JO B _ C L A S S → C H G _ H O U R
Th ird No rm al Form (Continued)

A n d giv e a nam e for the new tab le tha t refle c ts its


con te n t and fun c tio n .

E xa m p le

• JO B (JO B _ C L A S S , C H G _ H O U R )
Th ird No rm al Form (Continued)

For Ste p 3, to rem o v e the dep e n d e n t attrib u te s from


tran s itiv e dep e n d e n c ie s :
• Elim in a te all dep e n d e n t attrib u te s in tran s itiv e
rela tio n s h ip (s ) from eac h tab le ;
• D ra w a new de p e n d e n c y dia g ra m to sho w all tab le s
defin e d in in Ste p 1 to 3; and
• C h e c k the new and m o d ifie d tab le s in Ste p 3 to
m a k e sure tha t eac h has a dete rm in a n t and doe s
not con ta in ina p p ro p ria te de p e n d e n c ie s .
Th ird No rm al Form (Continued)

B y rem o v in g the dep e n d e n t attrib u te s the res u lt will


hav e the follo w in g tab le s :

• P R O J E C T (P R O J _ N U M , P R O J _ N A M E )
• E M P L O Y E E (E M P _ N U M , E M P _ N A M E ,
JO B _ C L A S S )
• A S S IG N (P R O J _ N U M , E M P _ N U M ,
A S S IG N _ H O U R S )
• JO B (JO B _ C L A S S , C H G _ H O U R S )
Th ird No rm al Form (Continued)

3N F D e p e n d e n c y Dia g ra m
Th ird No rm al Form (Continued)

To che c k if the data b a s e is in 3N F, if the des ig n is in


2N F (w ith no partia l dep e n d e n c ie s ) and has no
tran s itiv e dep e n d e n c ie s .
Im p rovem e n t in Da tab a se De sig n
Ta b le stru c tu re s are cle a n e d to elim in a te the
trou b le s o m e initia l, partia l, and tran s itiv e
dep e n d e n c ie s . N o rm a liz a tio n is valu a b le bec a u s e its
prin c ip le to elim in a te data red u n d a n c ie s .

H o w e v e r, to m a k e a goo d data b a s e des ig n , nob o d y


can rely on norm a liz a tio n pro c e s s but from the
initia tiv e and und e rs ta n d in g of a pers o n w o rk in g
beh in d the des ig n .
End

You might also like