Top Banner
9
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Normalization in a Database
Page 2: Normalization in a Database

What is Normalization? It’s a process of minimizing DATA redundancy. The main objectivity is to divide the table as an user friendly way to update, edit and delete any data without accessing each table. At the end we’ll be able to Insert, delete, update data without any problems.

INSERT ANOMALY: This refers to the situation when it is impossible to insert certain types of data into the database.

DELETE ANOMALY: The deletion of data leads to unintended loss of additional data, data that we had wished to preserve.

UPDATE ANOMALY : This refers to the situation where updating the value of a column leads to database inconsistencies (i.e., different rows on the table have different values).

Page 3: Normalization in a Database

Different levels of Database Normalization

1st Normal Form (1NF)

2nd Normal Form (2NF)

3rd Normal Form (3NF)

Note There are 5 Normalization Forms, We are only focusing 3 of them.

Page 4: Normalization in a Database

1st Normal Form (1NF)

The Database in First Normal form should completed the below conditions.• Contains only non dividable values (Atomic Values).• No Replica (Cannot contain Duplication).• It Should be in un-normalized Form.

Page 5: Normalization in a Database

Item ID Item Cost (Rs.)

A001 Rata Kaju, Idiyappa 70

A002 Lemonade 30

A003 Spaghetti 150

A004 Lemonade 40

A005 Kottu 160

Item ID Cost (Rs.)

A001 70

A002 30

A003 150

A004 40

A005 160

Item ID Item

A001 Rata Kaju

A001 Idiyappa

A002 Lemonade

A003 Spaghetti

A004 Lemonade

A004 Kottu

Product Table

Product Price Table Item Table

Page 6: Normalization in a Database

2nd Normal Form (2NF)

The Database in Second Normal form should completed the below conditions.• It Should be in 1st Normal Form.

• All Non-Keys should be dependent to the Primary Key.

NoteNon-key attributes are attributes other than candidate key attributes in a table.

Page 7: Normalization in a Database

Purchase ID Bar Code ID Store Location

A001 Bar001 Left Store

A002 Bar002 Underground Store

A001 Bar001 Left Store

A004 Bar003 Main Store

A004 Bar002 Underground Store

Purchase ID Bar Code ID

A001 Bar001

A002 Bar002

A001 Bar001

A004 Bar003

A004 Bar002

Bar Code ID Store Location

Bar001 Left Store

Bar002 Underground Store

Bar003 Main Store

Composite Key Purchase Table

Purchase Bar Code Table Item Location Table

Page 8: Normalization in a Database

3rd Normal Form (3NF)

The Database in Third Normal form should completed the below conditions.• It Should be in 2st Normal Form.• There is no transitive functional dependency.

Page 9: Normalization in a Database

Class ID Course ID Course Name

Re001 0037 Computer Science Yamanato

Re002 0045 Cookery Jhon

Re001 0037 Computer Science Khan

Re002 0045 Cookery Elina

Re005 0016 Fashion Designing Suman

Class ID Course ID Name

A001 0037 Yamanato

A002 0045 Jhon

A003 0037 Khan

A004 0045 Elina

A005 0016 Suman

Course ID Course

0037 Computer Science

0045 Cookery

0016 Fashion Designing

Composite Key Student Registry Table

Student Registry Name Table Course Table