NORMALIZATION IN DBMS
Ms.Mary Sanjana Joseph
Department of Computer Science(UG)
Kristu Jayanti College(Autonomous)
K.Narayanapura ,Kothannur
Bengaluru-560077
2.
NORMALIZATION
• Normalization isthe process of organizing the data in the
database.
• Minimize the redundancy from a relation.
• Eliminate undesirable characteristics like Insertion, Update, and
Deletion Anomalies.
• Normalization divides the larger table into smaller and links them
using relationships.
3.
ANOMALIES
• Insertion Anomaly:
Cannotinsert a new tuple into a relationship due to lack of
data.
• Deletion Anomaly:
The deletion of data results in the unintended loss of some
other important data.
• Updation Anomaly:
Updation of a single data value requires multiple rows of data
to be updated.
4.
UPDATION ANOMALY
Imagine wehave a simple database for a small library.
The library keeps track of books and the authors who write them.
Book Author Email
Programming in C Balaguruswamy balaguru@example.c
om
Programming in C++ Balaguruswamy balaguru@example.c
om
OOP in Java Balaguruswamy balaguru@example.c
om
Learning Python Alice Smith alice@example.com
Java Basics Bob Brown bob@example.com
The Great Novel Smith Brown sm@example.com
5.
INSERTION ANOMALY
Adatabase table for storing information about employees and the departments they work in.
The table is called Employee.
Suppose you need to add a new department
But you haven’t hired any employees for it yet.
Let's say the new department is "Marketing" located in "Chicago".
Since we don’t have any employees in this department yet,
Still want to record the existence of this department in the database
Employee Id Employee name Depatment Deptment Loc
E01 Alice Smith IT India
E02 Bob Brown HR New York
E03 Smith Brown IT India
1NF
A relationis in 1NF if it contains an atomic value.
StudentID StudentName Courses
S01 John Doe Math, Science
S02 Jane Smith History, Math
S03 Mark Lee Math
8.
NORMALIZED TABLE IN1NF
StudentID StudentName Courses
S01 John Doe Math
S01 John Doe Science
S02 Jane Smith History
S02 Jane Smith Math
S03 Mark Lee Math
9.
2NF
• In the2NF, relational must be in 1NF.
• In the second normal form, all non-prime key attributes are fully
functional dependent on the prime key(Candidate key)
10.
Student ID CIDStudent Name Course Name Instructor
S01 c1 Mary Maths Alice
S02 c2 Joseph Science Bob
S03 c3 Ann English John
Student ID Student
Name
S01 Mary
S02 Joseph
S03 Ann
CID CourseNam
e
Instructor
c1 Maths Alice
c2 Science Bob
c3 English John
Student ID CID
S01 c1
S02 c2
S03 c3
11.
3NF
Should bein 2NF
No transitive dependency.
Eg:
AB->C
C->D, where AB are the prime attributes
12.
Student ID CIDStudent Name Course Name Instructor
S01 c1 Mary Maths Alice
S02 c2 Joseph Science Bob
S03 c3 Ann English John
Student ID Student Name
S01 Mary
S02 Joseph
S03 Ann
CID CourseName Instructor
c1 Maths Alice
c2 Science Bob
c3 English John
Student ID CID
S01 c1
S02 c2
S03 c3
13.
IF CIDand Course Name can only produce the instructor
Where CID is the prime attribute but Course name not a prime
attribute then it is a transitive dependency