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

DB 8 Database Normalziation

The document discusses database normalization and different normal forms including: 1) Normalization is the process of organizing data to minimize redundancy. It involves separating data into tables and defining relationships between them. 2) There are different normal forms including 1NF, 2NF, 3NF, BCNF. Higher normal forms like 4NF and 5NF also exist. 3) The document provides examples of anomalies like insertion, deletion, update anomalies and how normalization addresses them.

Uploaded by

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

DB 8 Database Normalziation

The document discusses database normalization and different normal forms including: 1) Normalization is the process of organizing data to minimize redundancy. It involves separating data into tables and defining relationships between them. 2) There are different normal forms including 1NF, 2NF, 3NF, BCNF. Higher normal forms like 4NF and 5NF also exist. 3) The document provides examples of anomalies like insertion, deletion, update anomalies and how normalization addresses them.

Uploaded by

Mohsin Alee
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 22

Spring 2017

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:

First Student(Surname, Name, Skills)


Normal The attribute Skills can contain
multiple values and therefore the
Form relation is not in the first normal form.
But the attributes Name and Surname
are atomic attributes that can contain
only one value.
1 NF
First
Normal
Form
 If A and B are attributes of relation R, B is
functionally dependent on A, (denoted
A B),
if each value of A in R is associated with
exactly one value of B in R.
Functional  Example:
dependency ID Name
S1 Meier
S2 Weber

The attribute Name is functionally


dependent of attribute ID (ID  Name).
ArtistName→BirthYear

• Aslam was born in 1881

Functional Author, Title→PublDate


dependency
• Farhans’s ‘computer’ was published in
1979
 A database is in second normal form if it
2 NF satisfies the following conditions:
Second  It is in first normal form
Normal  All non-key attributes are fully
functional dependent on the primary
Form key
2 NF
Second
Normal
Form
Example
 By transitive functional dependency,
we mean we have the following
Transitive relationships in the table:
Functional
 A is functionally dependent on B,
Dependency and B is functionally dependent on C.
In this case, C is transitively
dependent on A via B.
 It is in second normal form
 There is no transitive functional
dependency

3 NF stId stName stAdr prName prCrdts


Third S1020 Sohail Dar I-8 Islamabad MCS 64

Normal S1038 Shoaib Ali G-6 Islamabad BCS 132


Form S1015 Tahira Ejaz L Rukh Wah MCS 64

S1018 Arif Zia E-8, BIT 134


Islamabad.
prName prCrdts
MCS 68

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

S1015 Tahira Ejaz L Rukh Wah MCS

S1018 Arif Zia E-8, Islamabad. BIT


 A general form of 3NF
 Every relation in BCNF is in 3NF vice-versa is
not always true
Boyce-  3NF is checked in steps, BCNF checked
Codd directly
Normal  A table is in BCNF if every determinant is a
Form candidate key
 Situation when table in 3NF is not in BCNF
 A non-key determines a part of the
composite primary key
After BCNF fourth, fifth and domain-
key normal forms exist
Higher 4NF deals with multivalued
dependency, fifth deals with possible
forms lossless decompositions, DKNF
reduces further chances of any
possible inconsistency
Thank You

22

You might also like