DB 8 Database Normalziation
DB 8 Database Normalziation
Introduction to
Database Systems
Saqib Nazir
MS(Computer Science)
Department of Software
Engineering,
Foundation University, Rawalpindi Lecture - 15
1
Normalization
Chapter - 13
2
Database normalization is the
process of organizing the attributes
and tables of a relational database to
minimize redundancy.
Normalization Normalization usually involves
dividing large tables into smaller
(and less redundant) tables and
defining relationships between
them.
The objective is to separate data so
that additions, deletions, and
modifications of a field can be made
in just one table and then
Normalization propagated through the rest of the
(Objectives) database using the defined
relationships.
Normalized design makes the
maintenance of database easier.
A state of DB that can lead the
DB to inconsistency or incorrect
state of database
Anomalies
Three types of anomalies are;
insertion, deletion and
Modification
SID NAME ADDRESS Subject
101 Ahmed islamabad Math
102 Waqas karachi Math
103 Aslam lahore Math
Redundancy 104 Farooq fasialabad English
105 Rafia multan Physics
106 Waqas karachi Physics
107 Aslam lahore English
108 Waqas karachi English
Address, Subject attributes have redundant
values.
SID NAME ADDRESS Subject
101 Ahmed islamabad Math
102 Waqas karachi Math
103 Aslam lahore Math
104 Farooq fasialabad English
105 Rafia multan
Insertion 106 Waqas karachi Physics
Anomaly 107 Aslam lahore English
108 Waqas karachi English
Suppose for a new admission, we have a
Student id(SID-105), name and address of a
student but if student has not registered for any
subjects yet then we have to insert NULL there,
leading to Insertion anomaly.
SID NAME ADDRESS Subject
101 Ahmed islamabad Math
102 Waqas Islamabad Math
103 Aslam lahore Math
104 Farooq fasialabad English
105 Rafia multan Physics
Updation 106 Waqas Islamabad Physics
Anomaly 107 Aslam lahore English
108 Waqas karachi English
To update address of a student who occurs
twice or more than twice in a table, we will have
to update Address column in all the rows, else
data will become inconsistent.
SID NAME ADDRESS Subject
101 Ahmed islamabad Math
102 Waqas Islamabad Math
103 Aslam lahore Math
104 Farooq fasialabad English
105 Rafia multan Physics
Deletion 106 Waqas Islamabad Physics
Anomaly 107 Aslam lahore English
108 Waqas karachi English
If (SID-105) has only one subject and
temporarily he drops it, when we delete that
row, entire student record will be deleted along
with it.
Different forms or levels of
normalization
Called first, second, third, fourth
and fifth normal forms
Normalization Each form has got certain
conditions
If a table fulfils the condition(s)
for a normal form then the table
is in that normal form
A relation is in first normal form if
every attribute in every row can
contain only one single (atomic) value.
A university uses the following
1 NF relation:
BCS 132
BIT 134
3 NF
Third stId stName stAdr prName
Normal
S1020 Sohail Dar I-8 Islamabad MCS
Form
S1038 Shoaib Ali G-6 Islamabad BCS
22