Beruflich Dokumente
Kultur Dokumente
Systems
CT014-3-2
Normalization II
Normalization II
Learning Outcomes
By the end of this lesson you should be
able to:
Demonstrate how to undertake process of
normalization.
Demonstrate how to identify the most commonly
used normal forms namely 1NF, 2NF, 3NF.
Normalization II
Keywords
1NF a relation is in 1NF if there are no
repeating groups in the relation.
2NF a relation is in 2NF if it is in 1NF and
there are no partial dependencies on the
primary key.
3NF a relation is in 3NF if it is in 2 NF
and there are no transitive dependencies.
CT014-3-2 Database and Web Database Systems
Normalization II
Normalization II
Normalization II
Normalization II
Normalization II
UNF to 1NF
Nominate an attribute or group of
attributes to act as the key for the
unnormalized table.
Identify repeating group(s) in
unnormalized table which repeats for the
key attribute(s).
Normalization II
UNF to 1NF
Remove repeating group by:
entering appropriate data into the empty
columns of rows containing repeating data
(flattening the table).
Or by
placing repeating data along with copy of the
original key attribute(s) into a separate
relation.
Normalization II
Normalization II
1NF to 2NF
Identify primary key for the 1NF relation.
Identify functional dependencies in the
relation.
If partial dependencies exist on the primary
key remove them by placing them in a new
relation along with copy of their
determinant.
CT014-3-2 Database and Web Database Systems
Normalization II
Normalization II
2NF to 3NF
Identify the primary key in the 2NF relation.
Identify functional dependencies in the relation.
If transitive dependencies exist on the primary
key remove them by placing them in a new
relation along with copy of their determinant.
Normalization II
Normalization II
Normalization II
Normalization II
Normalization II
Exercise
Convert the following data into 3NF.
Clearly indicate all functional dependencies.
Proj.
Num
Project
Name
Chg/
Hour
Hurricane 101
102
104
John
David
Anne
Elect.Eng
65
Comm.Tech 60
Comm.Tech 60
Coast
101
103
John
June
Elect.Eng
Biol.Eng
Satellite
104
102
Anne
David
Comm.Tech 60
Comm.Tech 60
Normalization II
65
55
Hours
Billed
Total
Charge
13
16
19
Subtotals
15
17
Subtotals
18
14
Subtotals
845
960
1140
2945
975
935
1910
1080
840
1920
Total
6775
Exercise (contd)
1.
2.
3.
ProjNum
ProjName
Enumber
Ename
JobClass
ChgHr
HrsBilled
Hurricane
101
John
Elect. Eng.
65
13
Hurricane
102
David
Comm.Tech
60
16
Hurricane
104
Anne
Comm.Tech
60
19
Coast
101
John
Elect. Eng
65
15
Coast
103
June
Biol. Eng
55
17
Satellite
104
Anne
Comm. Tech
60
18
Satellite
102
David
Comm. Tech
60
14
Normalization II
Exercise (contd)
UNF
Billing(ProjNum, ProjName, (Enumber,
Ename, JobClass, ChgHr, HrsBilled))
1NF (Flatten table)
Billing2(ProjNum, Enumber, ProjName,
Ename, JobClass, ChgHr, HrsBilled)
Normalization II
Exercise (contd)
1NF (Flatten table)
Billing2(ProjNum, Enumber, ProjName, Ename,
JobClass, ChgHr, HrsBilled)
Functional Dependencies
ProjNum ProjName (partial dep.)
Enumber Ename, JobClass, ChgHr (partial dep.)
JobClass ChgHr (transitive dep.)
Normalization II
Exercise (contd)
2NF (Remove partial dependencies)
Project(ProjNum, ProjName)
EmpJob(Enumber, Ename, JobClass,
ChgHr)
Billing3(ProjNum, Enumber, HrsBilled)
Normalization II
Exercise (contd)
3NF (Remove transitive dependencies)
Job(JobClass, ChgHr)
Emp (Enumber, Ename, JobClass)
Project(ProjNum, ProjName)
Billing3(ProjNum, Enumber, HrsBilled)
Normalization II
Normalization II
Normalization II
Normalization II
UNF
Billing(ProjNum, ProjName, (Enumber, Ename, JobClass, ChgHr,
HrsBilled))
1NF (Flatten table)
Billing2(ProjNum, Enumber,
ProjName, Ename, JobClass, ChgHr,
HrsBilled)
Project(ProjNum, ProjName)
Billing2(ProjNum, Enumber, Ename,
JobClass, ChgHr, HrsBilled)
Functional Dependencies
ProjNum ProjName (partial dep.)
Enumber Ename, JobClass, ChgHr
(partial dep.)
JobClass ChgHr (transitive dep.)
Functional Dependencies
Enumber Ename, JobClass, ChgHr
(partial dep.)
JobClass ChgHr (transitive dep.)
Normalization II
Comparison (contd)
2NF(First method)
Project(ProjNum, ProjName)
EmpJob(Enumber, Ename, JobClass,
ChgHr)
Billing3(ProjNum, Enumber,
HrsBilled)
Project(ProjNum, ProjName)
EmpJob(Enumber, Ename, JobClass,
ChgHr)
Billing3(ProjNum, Enumber,
HrsBilled)
Normalization II
Comparison (contd)
3NF(First method)
Job(JobClass, ChgHr)
Emp (Enumber, Ename, JobClass)
Project(ProjNum, ProjName)
Billing3(ProjNum, Enumber,
HrsBilled)
Job(JobClass, ChgHr)
Emp (Enumber, Ename, JobClass)
Project(ProjNum, ProjName)
Billing3(ProjNum, Enumber,
HrsBilled)
Normalization II
Summary
Definitions for 1NF, 2NF and 3NF.
Converting relations into 3NF.
Normalization II
Next Session
SQL DDL.
Normalization II