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

DATABASE

NORMALIZATION
HND - 9
?
What is Data Redundancy ?
And
Why should we reduce that?
Reg No Name Marks Branch Branch_Tel

5646 Kasun 65 Kalutara 0344758457

5648 Sampath 60 Kalutara 0344758457

5688 Mareen 70 Panadura 0384526526

5690 Suneth 75 Panadura 0384526526


Issues due to data Redundancy

1) Insertion Anomaly
2) Deletion Anomaly
3) Update Anomaly
* Insertion Anomaly
Reg No Name Marks Branch Branch_Tel
5646 Kasun 65 Kalutara 0344758457
5648 Sampath 60 Kalutara 0344758457
5688 Mareen 70 Panadura 0384526526
5690 Suneth 75 Panadura 0384526526

Wasteful space
* Deletion Anomaly

Reg No Name Marks Branch Branch_Tel

5646 Kasun 65 Kalutara 0344758457

5648 Sampath 60 Kalutara 0344758457

5688 Mareen 70 Panadura 0384526526

5690 Suneth 75 Panadura 0384526526


* Updation Anomaly
Reg No Name Marks Branch Branch_Tel
5646 Kasun 65 Kalutara 0344758457
0344758555
5648 Sampath 60 Kalutara 0344758457
0344758555
5688 Mareen 70 Panadura 0384526526
5690 Suneth 75 Panadura 0384526526
Reg No Name Marks Branch_Id

5646 Kasun 65 1
5648 Sampath 60 1
5688 Mareen 70 2
5690 Suneth 75 2

Id Branch_Nam Branch_Tel
e
1 Kalutara 0344758457
2 Panadura 0384758457
Definitely we need
NORMALIZATION
Types of Normalization
1NF
Rules
Each column should contain Atomic values
id Name subjects

5646 Kasun C#

5648 Sampath Html , php

5688 Mareen C# , JAVA


A column should contain values that are of
the same type
id Name DOB

5646 Kasun 2/5/2000

5648 Sampath 24/5/1999

5688 Mareen 31st August 1999


Each column should have a unique name

id Name NIC

5646 Kasun 956623656

5648 Sampath 973656562

5688 Mareen 785962352


Order doesn’t matter
id Name NIC

2 Kasun 956623656

5 Sampath 973656562

1 Mareen 785962352
Game_ID Game_Nam Released_Year Companies_Involved Location
e
1 NFS Payback 2017 Electronic Arts, Ghost Los Angeles
2 Infinite 2016 Activision, Infinity California
warfare ward
3 Hitman 2016 Square Enix, Warner Tokyo
Bros
Game_I Companies_Involved Game_Name Map_Locatio Released_Year
D n

1 Electronic Arts NFS Payback Los Angeles 2017

1 Ghost NFS Payback Los Angeles 2017

2 Activision Infinite California 2016


warfare

2 Infinity ward Infinite California 2016


warfare

3 Square Enix Hitman Tokyo 2016

3 Warner Bros Hitman Tokyo 2016


Rules of second normal form
1. All tables must be in 1NF.
2. Each non key field must be about the
same thing as the primary key.
3. Each table must contain data only about
one type of thing
Game_I Companies_Involved Game_Name Map_Locatio Released_Year
D n

1 Electronic Arts NFS Payback Los Angeles 2017

1 Ghost NFS Payback Los Angeles 2017

2 Activision Infinite California 2016


warfare

2 Infinity ward Infinite California 2016


warfare

3 Square Enix Hitman Tokyo 2016

3 Warner Bros Hitman Tokyo 2016


Game_info
Game_ID Game_Name Map_Locatio Released_Yea
n r
1 NFS Payback Los Angeles 2017
2 Infinite warfare California 2016
3 Hitman Tokyo 2016

Game_ID Companies_Involved
1 Electronic Arts
1 Ghost
Company_info 2 Activision
2 Infinity ward
3 Square Enix
3 Warner Bros
Example 2:
3NF

Rules
• Be in 2NF
• Has no transitive functional dependencies
In the table able, [Book ID] determines [Genre ID], and [Genre ID] determines [Genre Type].

Therefore, [Book ID] determines [Genre Type] via [Genre ID] and we have transitive functional

dependency, and this structure does not satisfy third normal form.
Turn to 1NF and 2NF
1NF
2NF
This particular entity contain only primary key value.
In another way we can say that if there is more than
one primary key then the table is required to convert
into second normal form.
Example - 

The "Office" table which shown in First Normal Form is require to convert into
Second Normal Form.

Functional Dependecy in "Office" Table 


(Department_id, Employee_id) → (Department_name, Employee_name, Salary)

Partial Dependecy in "Office" Table 


Department_id → Department_name 
Employee_id → (Employee_name, Salary)

After 2NF the "Office" table is divided into two tables which are :
Turn to 3NF
answer

You might also like