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

Unit 2

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Unit 2

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Advanced Database Management System Notes

Unit-2
Normalization
❖ Normalization
In Relational Database design, the process of organizing data to minimize redundancy.
Normalization usually involves dividing a database into two or more tables without
losing information and defining relationships between the tables.

The goals of normalization process are:


1) To minimize data redundancy.
2) To minimize update, deletion and insertion anomalies.
3) Improve data integrity, scalability and data consistency.
4) Reduces disk space

The Normal Form is a state of a relation that results from applying some criteria
on that relation.
Various normal forms are given below:
1) First Normal Form (1NF)
2) Second Normal Form (2NF)
3) Third Normal Form (3NF)
4) Boyce-Codd Normal Form (BCNF)
5) Forth Normal Form (4NF)
6) Fifth Normal Form (5NF)

❖ Types of Normal Forms


Normal forms are used for the process of normalization of data and therefore for the database
design. Normal forms are used to eliminate or reduce redundancy in database tables.
• First Normal Form (1NF)
A relation R is in first normal form (1NF) if and only if all domains contain atomic values
only.
Example:
Cid Name Address Contact_no
Society City
C01 Emily Nana Bazar, Anand 9879898798,7877855416
C02 Jeniffer C.G.Road, Ahmedabad 9825098254
C03 Peter M.G.Road, Rajkot 9898787898
Above relation has four attributes Cid, Name, Address, Contact_no. Here
Address is composite attribute which is further divided in to sub attributes as Society
and City. Another attribute Contact_no is multi valued attribute which can store more
than one values. So above relation is not in 1NF.
Problem:
Suppose we want to find all customers for some particular city then it is difficult to retrieve.
Reason is city name is combined with society name and stored whole as address.
Solution:
Insert separate attribute for each sub attribute of composite attribute.

First Approach:
Determine maximum allowable values for multi-valued attribute.
Insert separate attribute for multi valued attribute and insert only one value on one attribute and
Page 1 of 3
Advanced Database Management System Notes

other in another attribute.


So, above table can be created as follows:
Customer:

Cid Name Society City Contact_no1 Contact_no2


C01 Emily Nana Bazar Anand 9879898798 7877855416
C02 Jeniffer C.G.Road Ahmedabad 9825098254
C03 Peter M.G.Road Rajkot 9898787898

Second Approach:
Remove multi valued attribute and place it in a separate relation along with the primary
key of a given original relation.
So, above table can be created as follows:
Customer:
Cid Name Society City
C01 Emily Nana Bazar Anand
C02 Jeniffer C.G.Road Ahmedabad
C03 Peter M.G.Road Rajkot

Customer_Contact:

Cid Contact_No
C01 9879898798
C01 7877855416
C02 9825098254
C03 9898787898

• Second Normal Form (2NF)


Prime attribute
An attribute, which is a part of the candidate-key, is known as a prime attribute.
Non-prime attribute
An attribute, which is not a part of the prime-key, is said to be a non-prime attribute.

A relation R is in second normal form (2NF) if and only if it is in 1NF and every non-
prime attribute of relation is fully dependent on the primary key.

Example:

StudentID ProjectID StudentName ProjectName


S89 S89 S89 S89
P09 P09 P09 P09
Olivia Olivia Olivia Olivia
Geo Location Geo Location Geo Location Geo Location

In the above table, we have partial dependency; let us see how,The prime key attributes are
StudentID and ProjectID.

As stated, the non-prime attributes i.e. StudentName and ProjectName should be functionally

Page 2 of 3
Advanced Database Management System Notes

dependent on part of a candidate key, to be Partial Dependent.The StudentName can be


determined by StudentID, which makes the relation Partial Dependent. The ProjectName can be
determined by ProjectID, which makes the relation Partial Dependent. Therefore, the
<StudentProject> relation violates the 2NF in Normalization and is considered a bad database
design.

To remove Partial Dependency and violation on 2NF, decompose the above tables
StudentInfo

StudentID ProjectID StudentName


S89 S89 S89
P09 P09 P09
Olivia Olivia Olivia
S76 S76 S76

ProjectInfo

StudentID ProjectName
P09 Geo Location
P07 Cluster Exploration
P03 IoT Devices
P05 Cloud Deployment

• Third Normal Form (3NF)


A relation that is in First and Second Normal Form and in which no non-primary-key attribute
is transitively dependent on the primary key, then it is in Third Normal Form (3NF).

The normalization of 2NF relations to 3NF involves the removal of transitive dependencies. If a
transitive dependency exists, we remove the transitively dependent attribute(s) from the relation
by placing the attribute(s) in a new relation along with a copy of the determinant.

Example:

STU_ID STU_NAME STU_STATE STU_COUNTRY STU_AGE


1 RAMESH HARYANA INDIA 20
2 RAM PUNJAB INDIA 23
3 SURESH GUJARAT INDIA 24
FD set:
{STUD_NO->STUD_NAME,STUD_NO->STUD_STATE,STUD_STATE->
STUD_COUNTRY, STUD_NO -> STUD_AGE}
Candidate Key:
{STUD_NO}

For this relation in given table STUD_NO -> STUD_STATE and STUD_STATE ->
STUD_COUNTRY are true. So STUD_COUNTRY is transitively dependent on STUD_NO. It
violates the third normal form.

To convert it in third normal form, we will decompose the relation STUDENT (STUD_NO,
STUD_NAME, STUD_PHONE, STUD_STATE, STUD_COUNTRY_STUD_AGE) as:
STUDENT (STUD_NO, STUD_NAME, STUD_PHONE, STUD_STATE, STUD_AGE)
STATE_COUNTRY (STATE, COUNTRY)

Page 3 of 3

You might also like