0% found this document useful (0 votes)
2 views

Unit-4 Database Normalization

Uploaded by

Kunal Kharga
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Unit-4 Database Normalization

Uploaded by

Kunal Kharga
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

UNIT-4: DATABASE NORMALIZATION Dipesh Koirala

OUTLINE
❖ Definition and Importance of Normalization
❖ Functional Dependencies
❖ Normalization: 1NF, 2NF, 3NF, BCNF and 4NF
INTRODUCTION
❖ Anomalies means problems or inconsistency which happened during the operations performed on
the table.
❖ Occurs when data is stored multiple times or stored in single table.
❖ Normalization is used to overcome the anomalies.

ID Name Depart Depart Code Depart_Head


INTRODUCTION
Insertion Anomaly
❖ When certain data or attributes cannot be inserted into the database without the presence of
other data, it's called insertion anomaly.
❖ E.g., Insert new Depart
INTRODUCTION
Deletion Anomaly
❖ If we delete any data from the database and any other information which is required also
gets deleted with that deletion, then it is called deletion anomaly.
❖ A deletion anomaly occurs when data is unintentionally lost due to the deletion of other
data
❖ E.g., A student is leaving
INTRODUCTION
Updation Anomaly
❖ If we want to update any single piece of data then we have to update all other copies, it
comes under insertion anomaly.
❖ E.g., Change the name of Depart Head
NORMALIZATION
❖ Three rules IR1 through IR3 that are well-known inference rules for functional dependencies. They
were proposed first by Armstrong (1974) and hence are known as Armstrong’s axioms.
i. IR1 (reflexive rule) : If X ⊇ Y, then X →Y
ii. IR2 (augmentation rule) : {X → Y} |= XZ → YZ
iii. IR3 (transitive rule) : {X → Y, Y → Z} |= X → Z
NORMALIZATION
❖ Normalization is the process of organizing the data in the database.
❖ Normalization is used to minimize the redundancy from a relation or set of relations.

❖ It is also used to eliminate the undesirable characteristics like Insertion, Update, and Deletion
Anomalies.
❖ Normalization divides the larger table into smaller tables and links them using relationships.
NORMALIZATION
1NF
❖ It states that the domain of an attribute must include only atomic (simple, indivisible) values.
NORMALIZATION
2NF
❖ Should be in 1NF
❖ Builds on 1NF by ensuring that all non-key attributes are fully functional dependent on the
primary key.
❖ Eliminates partial dependency.

SID Sname CID CourseName Instructor

1 Alice 101, 103 Math, History Dr. Smith, Dr.jee

2 Bob 102 Science Dr. jones


NORMALIZATION
3NF
❖ Ensure that the table is in 2NF, and no non-prime attribute is transitively dependent on the
primary key.
❖ Ensures that all attributes are only dependent on the primary key.
❖ Eliminates transitive dependency.

EMP_ID EMP_Name EMP_Zip EMP_State EMP_City

101 John 44600 Bagmati Kathmandu

102 Jack 33700 Lumbini Pokhara


NORMALIZATION
BCNF – Stricter Version of 3NF
❖ Relation should be in 3NF
❖ For every functional dependency (X → Y), X must be a superkey:

❖ This means that every determinant (the left-hand side of a functional dependency) must be a
candidate key (a unique identifier for a tuple).

StudentID CourseID Instructor


S1 C101 Dr. Smith
S2 C101 Dr. Smith
S3 C102 Dr. Brown
NORMALIZATION
BCNF – Stricter Version of 3NF
Functional Dependencies
StudentID -> CourseID, Instructor
CourseID -> Instructor

CourseID -> Instructor violates BCNF because CourseID is not a super key.

Construct
Table1: Student-Course { StudentID (primary key), CourseID}
Table2: Course-Instructor {CourseID (primary key), Instructor}
NORMALIZATION
4NF
❖ A table is in 4NF if it is in Boyce-Codd Normal Form (BCNF) and has no multi-valued
dependencies.

StudentID Course Games


1 Math Football
1 Math Chess
1 Science Football
1 Science Chess
2 Math Cricket
2 Math Volleyball
NORMALIZATION
4NF
Multi-Valued Dependencies:
❖StudentID ↠ course
❖StudentID ↠ Games

i.e., A student can take multiple courses and participate multiple games

Decompose:
Table 1: Student-Course {StudentID, Course} both primary key
Table 2: Student-Game {StudentID, Game} both primary key
Now, each table represents a single multi-valued dependency.
THANK YOU End of Unit 4

You might also like