You are on page 1of 29

Normalisation

Name: Nitika Kumari Name: Harshita Name: Charu Bisht


Roll No. : 230313053016 Roll No. : 230313053011 Roll No. : 230313053003

Course: Master of Computer Application


Semester & Year : 1st sem and !st year
Table of contents

01 What is Normalisation 02 Anomalies

Prerequisites -
03 Functional Dependency 04 1st Normal Form

05 2nd Normal Form 06 3rd Normal Form


Table of contents

07 BCNF 08 4th Normal Form

09 5th Normal Form 10 Summary


01
What is Normalisation
Normalisation In DBMS, is series of guidelines that help to ensure that the design of a
database is efficient, organized, and free from data anomalies.

We Need Normalisation for:


● Data Integrity: Normalization ensures that data is organized efficiently, reducing the risk
of inconsistencies, redundancies, and errors.

● Minimize Redundancy: By eliminating duplicate data, normalization reduces storage


requirements and prevents data anomalies.

● Anomaly Prevention: It mitigates insertion, update, and deletion anomalies, maintaining


data consistency and accuracy.

● Simplify Database Maintenance: Normalized databases are easier to maintain and


modify, reducing complexity and enhancing scalability.

● Support for Data Operations: Well-normalized databases facilitate efficient querying,


reporting, and data manipulation operations.
02
Anomalies
Anomalies refer to unexpected or undesirable behaviors that can occur when the database is
not properly normalized.
There are three main types of anomalies associated with normalization:

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.

Fd: X → Y (If a value of X is available, value of Y can be searched in the table)’


Where X - Determinant and Y - Dependent

Why “Functional” Dependency?


Like functions for same value of x you get y
f(x) = y (if it is true)
f(x) ≠ z ,
Similarly,

A → 1 (If True)
A → 2 (False)

B → 2 (False)

Functional dependency helps in normalization by identifying the relationships between


attributes, allowing for the decomposition of tables
04
1st Normal Form
A table is in 1st Normal Form:

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 → Name, Course

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:

1) Relation must be in 1st Normal Form


2) Removes partial dependencies by ensuring that non-key attributes are fully
dependent on the primary key or there should be no partial dependency.

Customer_ID → Store_ID
Store_ID→ Customer_ID

(Customer_ID, Store_ID) → Location

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:

1) Relation must be in 2nd Normal Form


2) There should be no Transitive dependency in the relation. In other words if at least
one of the following conditions for every non- trivial dependency a) X is a super key
b) Y is part of CK

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_ Country

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.

Rule 1: The table should be in the 3rd Normal Form.


Rule 2: X should be a superkey for every functional dependency
(FD) X -> Y in a given relation.

NOTE: Redundancies are sometimes still present in BCNF


relation as it is not always possible to eliminate them
completely.

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 :

1) Should be in Boyce-Codd NF and has no multivalued dependency.


2) Multivalued dependency occurs when two or more independent multi-valued facts
about same attribute occurs within the same relation.
3) Multivalued Dependency is denoted by
X -> -> Y
I.e., there is a multi-dependency of Y or X multi-determines Y

Here, Course and Hobby are two independent entity. Hence, there is no relation between
Course and Hobby.
Tables:
Explanation:

Given table is in 3NF, but course & hobby are


two independent entity. Hence, there is no
relationship between course & hobby.

In student relation, a student with ID 1


contains 2 courses (computer & maths) and
2 hobbies (Dancing & singing). So there is a
multivalued dependency on ID which leads
to unnecessary repetition of data.

So, to make table in 4NF, we can decompose


it into 2 tables.

Table1 - ID_Course
Table2 - ID_Hobby
9
5th Normal Form
A table is in 5th Normal Form :

1) Also known as Project-Join Normal Form.


2) It should be in 4th NF and won’t have lossless decomposition into smaller tasks.
3) 5NF is satisfied when all the tables are broken into as many tables as possible in
order to avoid redundancy.
4) A relation is in 5NF, if the candidate key implies every join dependency in it(lossless
decomposition).

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

You might also like