DATABASE MANAGEMENT SYSTEM
(18CS53)
ASSIGNMENT-3
OWAIS AYOUB GANAIE
1JT20CS056
1. Explain the Normal forms in detail.
First Normal Form (1NF)
First normal form is now considered to be part of the formal definition of a relation;
historically,it was defined to disallow multivalued attributes, composite attributes, and their
combinations. It states that the domains of attributes must include only atomic (simple,
indivisible) values and that the value of any attribute in a tuple must be a single value from the
domain of that attribute.
Practical Rule: "Eliminate Repeating Groups," i.e., make a separate table for each set of related
attributes, and give each table a primary key.
Formal Definition: A relation is in first normal form (1NF) if and only if all underlying simple
domains contain atomic values only.
Second Normal Form (2NF)
The second normal form is based on the concept of fully functional dependency. A functional X
Y is a fully functional dependency is removal of any attribute A from X means that the
dependency does not hold any more. A relation schema is in 2NF if every nonprime attribute in
relation is fully functionally dependent on the primary key of the relation. It also can be restated
as: a relation schema is in 2NF if every nonprime attribute in relation is not partially dependent
on any key of the relation. Practical Rule: "Eliminate Redundant Data," i.e., if an attribute
depends on only part of a multivalued key, remove it to a separate table.
Formal Definition: A relation is in second normal form (2NF) if and only if it is in 1NF and
every nonkey attribute is fully dependent on the primary key.
Third Normal Form (3NF)
Third normal form is based on the concept of transitive dependency. A functional dependency
XY in a relation is a transitive dependency if there is a set of attributes Z that is not a subset of
any key of the relation, and both X Z and Z Y hold. In other words, a relation is in 3NF if,
whenever a functional dependency X A holds in the relation, either (a) X is a superkey of the
relation, or (b) A is a prime attribute of the relation.
Practical Rule: "Eliminate Columns not Dependent on Key," i.e., if attributes do not contribute to
a description of a key, remove them to a separate table.
Formal Definition: A relation is in third normal form (3NF) if and only if it is in 2NF and every
nonkey attribute is nontransitively dependent on the primary key.
1NF: R is in 1NF iff all domain values are atomic.
2NF: R is in 2 NF iff R is in 1NF and every nonkey attribute is fully dependent on the key.
3NF: R is in 3NF iff R is 2NF and every nonkey attribute is non-transitively dependent on the
key.
Boyce-Codd Normal Form (BCNF)
A relation schema R is in Boyce-Codd Normal Form (BCNF) if whenever a FD X -> A holds in
R, then X is a superkey of R
Each normal form is strictly stronger than the previous one:
Every 2NF relation is in 1NF Every 3NF relation is in 2NF
Every BCNF relation is in 3NF
There exist relations that are in 3NF but not in BCNF
A relation is in BCNF, if and only if every determinant is a candidate key.
Additional criteria may be needed to ensure the the set of relations in a relational database are
satisfactory.
If X Y is non-trivial then X is a super key
STREET CITY ZIP{CITY,STREET } ZIP ZIP CITY
Insertion anomaly: the city of a zip code can‘t be stored, if the street is not given.
Multivalued Dependencies and Fourth Normal Form (4NF)
4NF associated with a dependency called multi-valued dependency (MVD). MVDs in a relation
are due to first normal form (1NF), which disallows an attribute in a row from having a set of
values.
MVD represents a dependency between attributes (for example, A, B, and C) in a relation, such
that for each value of A there is a set of values for B, and a set of values for C. However, the set
of values for B and C are independent of each other.
MVD between attributes A, B, and C in a relation using the following notation:
A B (A multidetermines B)
AC
Formal Definition of Multivalued Dependency
A multivalued dependency (MVD) X Y specified on R, where X, and Y are both subsets of R
and Z = (R – (X Y)) specifies the following restrictions on r(R)
t3[X]=t4[X]=t1[X]=t2[X]
t3[Y] = t1[Y] and t4[Y] = t2[Y]
t3[Z] = t2[Z] and t4[Z] = t1 [Z]
Fourth Normal Form (4NF)
A relation that is in Boyce-Codd Normal Form and contains no MVDs. BCNF to 4NF involves
the removal of the MVD from the relation by placing the attribute(s) in a new relation along with
a copy of the determinant(s).
A Relation is in 4NF if it is in 3NF and there is no multivalued dependencies.
Join Dependencies and 5 NF
A join dependency (JD), denoted by JD{R1, R2, ..., Rn}, specified on relation schema R,
specifies a constraint on the states r of R. The constraint states that every legal state r of R should
have a lossless join decomposition into R1, R2, ..., Rn; that is, for every such r we have
* (R1(r), (R2(r) ... (Rn(r)) = r
Lossless-join property refers to when we decompose a relation into two relations - we can rejoin
the resulting relations to produce the original relation. However, sometimes there is the
requirement to decompose a relation into more than two relations. Although rare, these cases are
managed by join dependency and 5NF.
5NF (or project-join normal form (PJNF))
A relation that has no join dependency.
Definition: A relation schema R is in fifth normal form (5NF) (or project-join normal form
(PJNF)) with respect to a set F of functional, multivalued, and join dependencies if, for every
nontrivial join dependency JD(R1, R2, ..., Rn) in F + , every Ri is a superkey of R.
Figure 15.15 (c)The relation SUPPLY with no MVDs is in 4NF but not in 5NF if it has the
JD(R1, R2, R3).
The relation SUPPLY with no MVDs is in 4NF but not in 5NF if it has the JD(R1, R2, R3).
For example of a JD, consider once again the SUPPLY all-key relation in Figure
15.15(c). Suppose that the following additional constraint always holds: Whenever a
supplier s supplies part p, and a project j uses part p, and the supplier s supplies at least
one part to project j, then supplier s will also be supplying part p to project j. This
constraint can be restated in other ways and specifies a join dependency JD(R1, R2, R3)
among the three projections R1(Sname, Part_name), R2(Sname, Proj_name), and
R3(Part_name, Proj_name) of SUPPLY.
Figure 15.15(d) shows how the SUPPLY relation with the join dependency is
decomposed into three relations R1, R2, and R3 that are each in 5NF. Notice that
applying a natural join to any two of these relations produces spurious tuples, but
applying a natural join to all three together does not.