Normal Forms 1 2 3 BCNF
Normal Forms 1 2 3 BCNF
Def: Normalization is the process of decomposing a set of relations with anamolies to produce smaller and well
structured relations that contain minimum or no redundancy.
Def: Normalization is the process of reducing /decomposing a relation into a set of small relations free from data
redundancy and ensuring data integrity.
OBJECTIVES
The basic objective of normalization is to reduce the data redundancy and prevent loss of information or avoid
inconsistencies when the data base is altered.
The types of alterations needed for relations are:
1. Insertion of new data values to a relation.
2. Deletion of tuple or a row in a relation.
3. Updating or changing the value of an attribute in a tuple.
• The normalized relation does not include spurious information when the original schema is reconstructed.
• Preserves dependencies present in the original database
FUNCTIONAL DEPENDENCY:
Normalization beyond INF relies on functional dependency.
The term ful functional dependency (FFD) is used to indicate the minimum set of attributes in a
determinant of a FD.
In other words, the set of attributes X will be fully functionally dependent on the set of attributes Y if.
X is functionally dependent on Y and
X is not functionally dependent on any subset of Y Eg.
Note: Like FD, FFD is a property of the information presented by the relation.
It is not an indication of the way that attributes are formed in to relations or current contents of
the relations.
b. FUNCTIONAL DEPENDENCY
One of the candidate key is choosen as primary key and others are secondary keys.
Prime attribute: An attribute of a relation schema R is called a prime attribute of R if it is a member of some
candidate key of R.
Non prime attribute: An attribute is called a non prime attribute if it is not a prime attribute i.e. an attribute is
said to be a non-prime attribute if it is not a part of the candidate keys.
Prove IR4 through IR8 by using IRI through IR3
Stdinf
Roll No Name DOB
101 Rakesh 14.11.1985
102 Tapan 18.07.1986
Teacherinf
Subject Teacher
RDBMS Smith
DEC Johnes
MATH-II Allen
PHY-II Clark
NT Martin
Courseinf
101 MATH-II O
101 PHY-II E
101 NT A
(ii) Closure
(iii) Identify the candidate key
(iv) IS it in 2NF ?
(v) If not decompose it in to 2 NF form. Solution: The given
functional Dependencies are:
{A} {B}, {A} {C}, {D} {E}, {AD} {F}
Super key of R is {AD}
Closure A+ = {A,B,C}
D+= {D,E}
{A,D} + = {A,B,C,D,E,F}
There is no such single key that can derive /determine the other attribute.
Here we take two keys together i.e. {AD} as the minimum super key. Hence the
candidate key is {AD}.
{RollNo} {Name}
{Roll No} {Address}
{Course no} {Course name}
{Roll No, Course no} {Grade}
Problems
(1) IF we want to insert a new course then it can’t be inserted unless a new student roll no, is created.
(2) If we delete a student roll no, the subject or course information is deleted if the course in taken by
only student.
(3) If we update a name, address it has to be updated at many places.
(4) redundancy exist at many places.
So, we decompose the relation student into subrelators as: Student (roll no, name, address, courseno, coursename,
grade)
R (A,B,C,D,E,F)
Here transitive dependency exists, as proj. no determines manager and manager determines address.
If a manager is associated with more than one project then his address is repeated leading to
data redundancy.
If we need to change address of a manager we need to change at many places leading to updation
anomalies.
So, we split the table in to two relations.
The determinant attributes become the primary key in the new relation
The attribute manager becomes the link between two tables/new relations.
Project
Proj.no Manager
P1 Black, B
P2 Smith, J
P3 Black, B
P4 Black,B
P5 Thomas,J
Manager
Manager Address
Here in project relation , proj.no serves as the primary key and manager can be determined by project
no.
In manager relation, address can be determined by knowing the manager name, so, manager becomes the
primary key.
So, in the above relation the non prime attributes depend upon the primary key.
Hence we can define the third normal form as below
Find the non. key attributes and remove them that are functionally dependent on attributes that are not
the primary key.
Place them in a different relation.
Third Normal Form (3NF) (Summary)
A relation R is said to be in third normal form (3NF) if the relation R is in 2NF and non- prime attributes are:
Mutually independent
Functionally dependent on the primary key
In other words, no attributes of the relation should be transitively dependent on the primary key.
Thus in 3NF, no non prime attribute is functionally dependent on another non- prime attribute.
This means that a relation in 3NF consists of the primary key and a set of independent non
prime attributes.
Summary of Normal Forms
1NF Relation should have no non atomic Forms new relations for each non atomic
attributes attribute or rested relations.
2NF For relations where primary key contains Decompose and set up a new relation for each partial
multiple attribute s no non key attribute should be
key with its dependent attribute(s) make sure to keep a
functionally dependent on a primary key.
relation with the original primary key and any
attributes that are fully functionally
dependent onit.
3NF A relation should have a nonkey attribute Decompose and set up a relation that includes the non
functionally determined by another nonkey key attribute(s) that functionally determine (s) other
non key attributes.
attribute (or by a set of non key attributes)
.That is , there should be no transitive
dependency of non key attribute on the
primary key.
R (A,B,C,D)
R2 (C, D) Since { C D}
BCNF:
Def1: A relation is said to be in BCNF if and only if every determinant is a candidate key. Def: A relation is said
to be in BCNF if and only if it is in 3NF or 2NF and for every non trivial functional dependency XY.
(i) X is a super key
(i) X Y is trivial or
R1 (A,B) R2 (B,C)
Now R1 and R2 in BCNF
The decomposition is lossless and dependency preserving.
Boyce Code Normal Form (BCNF)
To eliminate the problems and redundancy of 3NF. Boyce proposed a normal form known as Boyee
code Normal form (BCNF).
When the relation has more than one candidate key anamolies may arise even though the relation is in
3NF.
3NF does not deal with the case of a relation with overlapping candidate keys.
BCNF is based on the concept of a determinant
A determinant is any attribute(s) on which some other attributes is fully functionally dependent.
R (A,B,C)
R1 (A,C) R2 (B,C)