Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 6

WEEK-4

DATA BASE NORMALIZATION


By: Shafiullah
Lecturer CS/IT
What is normalization ?

• NORMALIZATION is a database design technique that reduces data


redundancy and eliminates undesirable characteristics like Insertion, Update
and Deletion Anomalies. Normalization rules divides larger tables into
smaller tables and links them using relationships.
without Normalization we may face many issues such as
• Insertion anomaly: It occurs when we cannot insert data to the table
without the presence of another attribute
• Update anomaly: It is a data inconsistency that results from data
redundancy and a partial update of data.
• Deletion Anomaly: It occurs when certain attributes are lost because of the
deletion of other attributes.
Database Normal Forms
1. 1NF (First Normal Form)
2. 2NF (Second Normal Form)
3. 3NF (Third Normal Form)

To understand normal forms consider the following unnormalized


database table. Now we will normalize the data of below table using
normal forms.

Name Last name Age Address Course Teacher Salutation

Ali Khan 25 Peshawar Java/C++ Kamran/Shahid Dr/Ast-prof

Salim Jan 30 Charsada PHP Asfandyar Dr

Imran Jamal 50 Mardan C++/PHP Shahid/Asfandyar Dr/Ast-prof


1. First Normal Form (1NF)
A database table is said to be in 1NF if it contains no repeating fields/columns.
The process of converting the UNF(unormalized table) table into 1NF is as
follows:
1.Separate the repeating fields into new database tables along with the key
from the unnormalized database table.

Std_id Name Last name Age Address Course Teacher Salutation


STD-1 Ali Khan 25 Peshawar Java Kamran Dr
STD-1 Ali Khan 25 Peshawar C++ Shahid Ast-prof
STD-2 Salim Jan 30 Charsada PHP Asfandyar Dr
STD-3 Imran Jamal 50 Mardan C++ Shahid DR
STD-3 Imran Jamal 50 Mardan PHP Asfandyar Ast-prof
1. 2NF (Second Normal Form)
A database table is said to be in 2NF if it is in 1NF and contains
only those fields/columns that are functionally dependent(means the value
of the field is determined by the value of another field(s)) on the primary
key. In 2NF we remove the partial dependencies of any non-key field.
Course Table
Std_id Name Last name Age Address
C_id Course Teacher Salutation
STD-1 Ali Khan 25 Peshawar
C11 Java Kamran Dr
STD-2 Salim Jan 30 Charsada
C12 C++ Shahid Ast-prof
STD-3 Imran Jamal 50 Mardan
C13 PHP Asfandyar Dr

Student Table
3. 3NF (Third Normal Form
A database table is said to be in 3NF if it is in 2NF and all non-keys fields
should be dependent on primary key or We can also say a table to be in 3NF if it is
in 2NF and no fields of the table are transitively functionally dependent on the
primary key. The process of converting the table into 3NF is as follows:
1.Remove the transitive dependencies(A type of functional dependency where a
field is functionally dependent on the Field that is not the primary key. Hence its
value is determined, indirectly by the primary key )
2.Make a separate table for transitive dependent Field.
3NF of above 2NF tables is as follows: Salutation Table
Course Table
Std_id Name Last name Age Address SAL_ID Salutation
STD-1 Ali Khan 25 Peshawar C_id Course Teacher SAL_ID SAL100 Dr
SAL100 SAL112 Ast-prof
STD-2 Salim Jan 30 Charsada C11 Java Kamran
STD-3 Imran Jamal 50 Mardan C12 C++ Shahid SAL12
SAL100
Student Table C13 PHP Asfandyar

You might also like