Normalization
CONTENT
What is Normalization?
2
Data Redundancy
Anomalies
First Normal Form
Second Normal Form
Third Normal Form
Boyce -Codd Normal Form
1.
What is
Normalization
“
Normalization is a technique of
organizing data into multiple related
tables ,to minimize Data Redundancy
4
Data Redundancy means repetition of data
5
Reason
Two different but related table stored together.
Issues
1. Repetition of data increases size of database
2. Causes Anomalies
Anomalies are problems that can occur in poorly planned , un-
normalized databases where all data is stored in same table
Types
To insert redundant data for every new row is a data insertion
anomaly.
Loss of related dataset when some other dataset is deleted is
a deletion anomaly.
A data inconsistency that results from data redudancy and
partial update is updation anomaly.
Roll No. Name Branch HOD Office_tel
1
A CS Mr.x 2342
2
B CS Mr.x 2342
3
B CS Mr.x 2342
4
D CS Mr.x 2342
Roll No. Name Branch HOD Office_tel
1
A CS Mr.x 2342
2
B CS Mr.x 2342
3
B CS Mr.x 2342
Roll No. Name Branch HOD Office_tel
1
A CS Mr.x 2342
2
B CS Mr.x 2342
Roll No. Name Branch HOD Office_tel
1
A CS Mr.x 2342
Roll No. Name Branch HOD Office_tel
Student Table
Insertion and Deletion Anomaly
Roll No. Name Branch HOD Office_tel
1
A CS Mr.x 2342
2
B CS Mr.x 2342
3
B CS Mr.x 2342
4
D CS Mr.x 2342
Roll No. Name Branch HOD Office_tel
1
A CS Mr.x Mr.y 2342
2
B CS Mr.x 2342
3
B CS Mr.x 2342
4
D CS Mr.x 2342
Roll No. Name Branch HOD Office_tel
1
A CS Mr.x Mr.y 2342
2
B CS Mr.x Mr.y 2342
3
B CS Mr.x 2342
4
D CS Mr.x 2342
Roll No. Name Branch HOD Office_tel
1
A CS Mr.x Mr.y 2342
2
B CS Mr.x Mr.y 2342
3
B CS Mr.x 2342
4
D CS Mr.x Mr.y 2342
Student Table
Updation Anomaly
Roll No. Name Branch HOD Office_tel
1
A CS Mr.x 2342
2
B CS Mr.x 2342
3
B CS Mr.x 2342
4
D CS Mr.x 2342
Roll No. Name BranchID
1 A 1
2 B 1
3 B 1
4 D 1
BranchID HOD Office_tel
1 Mr.x 2342
Student Table
Dept Table
By dividing Student Table into Student and
Department Table we can eliminate all anomalies .
2.
1st Normal
Form
“
Every table in database should at least
follow the 1st normal form always . To be
in 1st normal form a table should follow
some rules.
11
▪Each table should
contain atomic values
12
Rule 1
colour A
Yellow 10,20,22
Blue 30,22,22
Orange 52,22,12
▪A column should
contain values of same
type
13
Rule 2
colour A
Yellow 22
Blue 22
12
Orange
▪Each column should
have a unique name
Place your screenshot here
14
Rule 3 colour A A
Yellow 22 20
Blue 22 15
Orange
12
24
colour A B
Yellow 22 20
Blue 22 15
Orange
12 24
3.
2st Normal
Form
“
For a table to be in second normal form :
▪It must be in 1st normal form
▪Their should be no partial dependency.
16
17
StudentID Name RegNo Branch Address
1
Akon CSE-18 CSE UP
2
Akon IT-18 IT UK
3
Bkon CSE-18 CSE MP
4
Dkon CSE-18 CSE RAJ
STUDENT TABLE
SubjectID SubjectName
1 C
2 C++
SUBJECT TABLE
SubjectID
StudentID
18
ScoreID StudentID SubjectID Marks Teacher
1 1 1 86 Mr.C
2 1 2 45 Mr.C++
3 3 1 98 Mr.C
4 2 1 78 Mr.C
SCORE TABLE
Partial Dependency
StudentID SubjectID Teacher
1. StudentID,SubjectID  ScoreID,Marks,Teacher
2. SubjectID  Teacher
19
Now the tables are in second Normal Form....
SubjectID SubjectName Teacher
1
C Mr.C
2
C++ Mr.C++
SUBJECT TABLE
ScoreID StudentID SubjectID Marks
1 1 1 86
2 1 2 45
3 3 1 98
4 2 1 78
SCORE TABLE
StudentID SubjectID
SubjectID
4.
3st Normal
Form
“
For a table to be in third normal form :
▪It must be in 2st normal form
▪Their should be no Transitive dependency.
21
22
ScoreID StudentID SubjectID Marks Exam_Name Total_Marks
1 123 1 23 PracticalC 30
2 124 1 12
PracticalC
30
StudentID SubjectID Total_Marks
Transitive Dependency
Exam_Name
1. StudentID,SubjectID  ScoreID,ExamName,Total_marks
2. ExamName Total_Marks
23
ScoreI
D
StudentI
D
SubjectID Mark
s
Teacher ExamID
1 123 1 23 Mr.C 1
2 124 1 12 Mr.C 1
Now the tables are in Third Normal Form....
ExamID Exam_N
ame
Total_Ma
rks
1
Practical
C
30
2
Practical
C++ 30
Student Table Exam Table
5.
Boyce Codd
Normal Form
“
For a table to be in boyce-codd normal form :
▪It must be in 3rd normal form.
▪For any dependency A B ,A should be a
super key.
25
26
StudentID Subject Professor
101 C++ p.Cpp
102 Python p.Python
103 Python p.Python2
104 Java p.java
COLLEGE ENROLLMENT TABLE
StudentID Subject
27
StudentID Subject Professor
COLLEGE ENROLLMENT TABLE
StudentID Subject
(student_id,subject) Professor
Professor Subject
Non prime attribute Non prime attribute
28
StudentID Professor
StudentID
Student Table
P ID Professor Subject
Student Table
P_ID
Professor Table
Now,our table is in BCNF
Thanks!
Any Questions ?
Presented By
•Manohar Bhasin
•Rishi Singh
•Sandeep kumar Singh

Normalization

  • 1.
  • 2.
    CONTENT What is Normalization? 2 DataRedundancy Anomalies First Normal Form Second Normal Form Third Normal Form Boyce -Codd Normal Form
  • 3.
  • 4.
    “ Normalization is atechnique of organizing data into multiple related tables ,to minimize Data Redundancy 4
  • 5.
    Data Redundancy meansrepetition of data 5 Reason Two different but related table stored together. Issues 1. Repetition of data increases size of database 2. Causes Anomalies
  • 6.
    Anomalies are problemsthat can occur in poorly planned , un- normalized databases where all data is stored in same table Types To insert redundant data for every new row is a data insertion anomaly. Loss of related dataset when some other dataset is deleted is a deletion anomaly. A data inconsistency that results from data redudancy and partial update is updation anomaly.
  • 7.
    Roll No. NameBranch HOD Office_tel 1 A CS Mr.x 2342 2 B CS Mr.x 2342 3 B CS Mr.x 2342 4 D CS Mr.x 2342 Roll No. Name Branch HOD Office_tel 1 A CS Mr.x 2342 2 B CS Mr.x 2342 3 B CS Mr.x 2342 Roll No. Name Branch HOD Office_tel 1 A CS Mr.x 2342 2 B CS Mr.x 2342 Roll No. Name Branch HOD Office_tel 1 A CS Mr.x 2342 Roll No. Name Branch HOD Office_tel Student Table Insertion and Deletion Anomaly
  • 8.
    Roll No. NameBranch HOD Office_tel 1 A CS Mr.x 2342 2 B CS Mr.x 2342 3 B CS Mr.x 2342 4 D CS Mr.x 2342 Roll No. Name Branch HOD Office_tel 1 A CS Mr.x Mr.y 2342 2 B CS Mr.x 2342 3 B CS Mr.x 2342 4 D CS Mr.x 2342 Roll No. Name Branch HOD Office_tel 1 A CS Mr.x Mr.y 2342 2 B CS Mr.x Mr.y 2342 3 B CS Mr.x 2342 4 D CS Mr.x 2342 Roll No. Name Branch HOD Office_tel 1 A CS Mr.x Mr.y 2342 2 B CS Mr.x Mr.y 2342 3 B CS Mr.x 2342 4 D CS Mr.x Mr.y 2342 Student Table Updation Anomaly Roll No. Name Branch HOD Office_tel 1 A CS Mr.x 2342 2 B CS Mr.x 2342 3 B CS Mr.x 2342 4 D CS Mr.x 2342
  • 9.
    Roll No. NameBranchID 1 A 1 2 B 1 3 B 1 4 D 1 BranchID HOD Office_tel 1 Mr.x 2342 Student Table Dept Table By dividing Student Table into Student and Department Table we can eliminate all anomalies .
  • 10.
  • 11.
    “ Every table indatabase should at least follow the 1st normal form always . To be in 1st normal form a table should follow some rules. 11
  • 12.
    ▪Each table should containatomic values 12 Rule 1 colour A Yellow 10,20,22 Blue 30,22,22 Orange 52,22,12
  • 13.
    ▪A column should containvalues of same type 13 Rule 2 colour A Yellow 22 Blue 22 12 Orange
  • 14.
    ▪Each column should havea unique name Place your screenshot here 14 Rule 3 colour A A Yellow 22 20 Blue 22 15 Orange 12 24 colour A B Yellow 22 20 Blue 22 15 Orange 12 24
  • 15.
  • 16.
    “ For a tableto be in second normal form : ▪It must be in 1st normal form ▪Their should be no partial dependency. 16
  • 17.
    17 StudentID Name RegNoBranch Address 1 Akon CSE-18 CSE UP 2 Akon IT-18 IT UK 3 Bkon CSE-18 CSE MP 4 Dkon CSE-18 CSE RAJ STUDENT TABLE SubjectID SubjectName 1 C 2 C++ SUBJECT TABLE SubjectID StudentID
  • 18.
    18 ScoreID StudentID SubjectIDMarks Teacher 1 1 1 86 Mr.C 2 1 2 45 Mr.C++ 3 3 1 98 Mr.C 4 2 1 78 Mr.C SCORE TABLE Partial Dependency StudentID SubjectID Teacher 1. StudentID,SubjectID  ScoreID,Marks,Teacher 2. SubjectID  Teacher
  • 19.
    19 Now the tablesare in second Normal Form.... SubjectID SubjectName Teacher 1 C Mr.C 2 C++ Mr.C++ SUBJECT TABLE ScoreID StudentID SubjectID Marks 1 1 1 86 2 1 2 45 3 3 1 98 4 2 1 78 SCORE TABLE StudentID SubjectID SubjectID
  • 20.
  • 21.
    “ For a tableto be in third normal form : ▪It must be in 2st normal form ▪Their should be no Transitive dependency. 21
  • 22.
    22 ScoreID StudentID SubjectIDMarks Exam_Name Total_Marks 1 123 1 23 PracticalC 30 2 124 1 12 PracticalC 30 StudentID SubjectID Total_Marks Transitive Dependency Exam_Name 1. StudentID,SubjectID  ScoreID,ExamName,Total_marks 2. ExamName Total_Marks
  • 23.
    23 ScoreI D StudentI D SubjectID Mark s Teacher ExamID 1123 1 23 Mr.C 1 2 124 1 12 Mr.C 1 Now the tables are in Third Normal Form.... ExamID Exam_N ame Total_Ma rks 1 Practical C 30 2 Practical C++ 30 Student Table Exam Table
  • 24.
  • 25.
    “ For a tableto be in boyce-codd normal form : ▪It must be in 3rd normal form. ▪For any dependency A B ,A should be a super key. 25
  • 26.
    26 StudentID Subject Professor 101C++ p.Cpp 102 Python p.Python 103 Python p.Python2 104 Java p.java COLLEGE ENROLLMENT TABLE StudentID Subject
  • 27.
    27 StudentID Subject Professor COLLEGEENROLLMENT TABLE StudentID Subject (student_id,subject) Professor Professor Subject Non prime attribute Non prime attribute
  • 28.
    28 StudentID Professor StudentID Student Table PID Professor Subject Student Table P_ID Professor Table Now,our table is in BCNF
  • 29.
    Thanks! Any Questions ? PresentedBy •Manohar Bhasin •Rishi Singh •Sandeep kumar Singh