Normalisation
Normalisation
Prerequisites -
03 Functional Dependency 04 1st Normal Form
1) Insertion Anomaly
These occur when you try to insert new data into the database. If the database is not
properly normalized, you may not be able to insert certain pieces of data without also
inserting other unrelated data
Suppose we want to add a new course to the database, but no students are currently
enrolled in it
2) Updation Anomaly
In a denormalized database, updating information in one place may require updating the
same information in multiple places, which can lead to inconsistencies or errors
Smith names is incorrectly written if we correct it for one student, we must ensure that name are
updated consistently throughout the table.
3) Deletion Anomaly
If the database is not properly normalized, deleting a record may unintentionally remove
other related data that should be preserved.
Dave decides to drop but if we delete the row, we would also lose information about the
Science course
03
Prerequisite - Functional
Dependency
Functional Dependency is a relationship that exists between 2 attributes. It typically exists
between the primary key and non key attribute within a table.
A → 1 (If True)
A → 2 (False)
B → 2 (False)
This is the most basic level of normalization. In 1NF, each table cell should contain only a
single value, and each column should have a unique name. The first normal form helps to
eliminate duplicate data and simplify queries.
Roll_Number → Name
Roll_Number → Course
Course→ Roll_Number
To convert it into 1NF, we need to ensure that each attribute contains atomic values. So we'll
create 2 seperate tables in which each course is written individually
05
2nd Normal Form
A table is in 2nd Normal Form:
Customer_ID → Store_ID
Store_ID→ Customer_ID
Store_ID → Location
Store_ID → Location
(Part of CK) ( Non PK)
Here, non prime attribute Location is dependent on Store_ID which is a part of Candidate key
that means partial dependency exists and to solve that we need to turn partial dependency
to full dependency.
06
3rd Normal Form
A table is in 3rd Normal Form:
Roll_Number → Zip
Roll_Number → Zip
Zip → City
(Non prime) ( Non prime) Zip → City
Here,non prime attribute City is dependent on non prime attribute Zip and transitively, City is
dependent on Roll_Number. So we need to move City and Zip to new table, with Zip as
Primary key to remove transitive dependency
07
BCNF Normal Form
A table is in BCNF(Boyce Codd Normal Form):
1) BCNF is a stricter form of 3NF that ensures that each determinant in a table is a
candidate key.
2) BCNF ensures that each non-key attribute is dependent only on the candidate key or
super key.
Emp_ID →Emp_Dept
Emp_ID → Emp_Country
Emp_Dept→ Dept_Type
Emp_Dept—> Emp_Dept_No
CK : Emp_ID, Emp_Dept
Emp_Dept→
Dept_type,Emp_Dept_No
Here, relation is not in BCNF because Dept_No is not a candidate key so to convert it into BCNF we
decompose it into 3 tables
BCNF is advanced version of 3NF.
There are also some higher- order normal forms, like the 4th
Normal form and the 5th Normal form.
08
4th Normal Form
A table is in 4th Normal Form :
Here, Course and Hobby are two independent entity. Hence, there is no relation between
Course and Hobby.
Tables:
Explanation:
Table1 - ID_Course
Table2 - ID_Hobby
9
5th Normal Form
A table is in 5th Normal Form :
Here, relation is not in 5th NF. First, we convert it in 4th NF by decomposing it into sub tables
and then, we join the tables by natural join, if it give the result same as original table,then it is
said to be in 5th NF.
10
Summary
Thanks!
Name: Nitika Kumari Name: Harshita Name: Charu Bisht
Roll No. : 230313053016 Roll No. : 230313053011 Roll No. : 230313053003