NORMALIZATION
NORMALIZATION
Ques 1) What is normalization? Write down the properties of the normalized relations.
Ans: Normalization
Normalization is the process of efficiently organizing data in a database. There are two
uses/goals of the normalization process:
1) Eliminating redundant data (e.g., storing the same data in more than one table).
2) Ensuring data dependencies make sense (only storing related data in a table).
Both of these are worthy goals as they reduce the amount of space a database consumes and
ensure that data is logically stored. The stages of normalization process are referred to as "normal
forms".
Properties of Normalized Relations
1) No data value should be duplicated in different rows unnecessarily.
2) A value must be specified (and required) for every attribute in a row.
3) Normalized relation should be self-contained. In other words, if a row from a relation is
deleted, important information should not be accidentally lost.
4) A value of an attribute in a tuple may be changed independent of other tuples in the relation
and other relations.
Ques 2) Describe the various anomalies in designing database.
OR
Describe insertion and deletion and updation anomalies.
Ans: Anomalies in a Database
1) Insertion Anomaly: An insert anomaly occurs when certain attributes cannot be inserted into
the database without the presence of other attributes. For example, it is not possible to record the
address of a student, unless he has registered for at least one subject. Also, one may insert a
different address, when a new tuple indicating his registration in a new course is added.
2) Update Anomaly: If one copy of such repeated data is updated, an inconsistency is created,
unless all copies are similarly updated. For example, a consequence of the redundancy may occur
if one may update the address in one tuple, while leaving it unchanged in another. Thus, one
would not have a unique address for each student.
3) Deletion Anomaly: This problem is inverse to insertion anomaly. It may not be possible to
delete certain information without losing some other, unrelated, information. For example, if a
student drops all the subjects in which he is registered, one will lose student's address.
For example, let consider the following table 4.1: Table 4.1: Employee
Id Name Lot Rating Hourly Hours
wages worked
123-22-3666 Attishoo 48 8 10 40
231-31-5368 Smiley 22 8 10 30
131-24-3650 Smethurst 35 5 7 30
434-26-3751 Guddu 35 5 7 32
612-67-4134 Madavan 35 8 10 40
The various anomalies in the above database Employee are: 1) Insertion Anomalies: One cannot
insert a tuple for an employee unless we know the hourly wage for the employee's rating value.
2) Update Anomalies: The hourly wages in the first tuple could be updated without making a
similar change in the second tuple.
3) Deletion Anomalies: If we delete all tuples with at given rating value (e.g., tuples of Smethurst
and Guddu) we lose the association between the rating value and its hourly wages value.
Ques 3) What is functional dependency? Write its use. What is functional dependency?
Or
What do you mean by functional dependency? What is the importance of functional
dependencies in database design?
Ans: Functional Dependency
A functional dependency occurs when ore attribute in a relation uniquely determines another
attribute. This can be written AB which would be the same as stating "B is functionally
dependent upon A".
A functional dependency (FD) is a constraint between two sets of attributes in a relation from a
database.
Given a relation R, a set of attributes X in R is said to functionally determine another attribute Y,
also in R, (written XY) if and only if each X value is associated with precisely one Y value. Here
X is called the determinant set and Y is called the dependent attribute.
Thus, given a tuple and the values of the attributes in X, one can determine the corresponding
value of the Y attribute. For the purposes of simplicity, given that X and Y are sets of attributes in
R, XY denotes that X functionally determines each of the members of Y - in this case Y is
known as the dependent set. Thus, a candidate key is a minimal set of attributes that functionally
determine all of the attributes in a relation.
A functional dependency FD: X→Y is called trivial if Y is a subset of X
The determination of functional dependencies is an important part of designing databases in the
relational model, and in database normalization and denormalization. The functional
dependencies, along with the attribute domains, are selected so as to generate constraints that
would exclude as much data inappropriate to the user domain from the system as possible.
Usage of Functional Dependency
Functional dependencies are used in two ways:
1) To set relations to see whether they are legal under a given set of functional dependencies. If a
relation R is legal under a set F of functional dependencies, then it is said that R satisfies F.
2) To specify constraints on the set of legal relations. We shall thus concern our-selves with only
those relations that satisfy a given set of functional dependencies. If we wish to constrain
ourselves to relations on schema. R that satisfies a set F of functional dependencies, we say that
F holds on R.
Importance of Functional Dependencies
1) It helps to optimize association.
2) Preserve data integrity.
3) Avoid data integrity.
4) It acts as a driving force for database design.
5)They are the expression of the facts for which the database id created.
Ques 4) What are Fully Functional Dependencies and Partial Functional Dependencies? Give an
example to distinguish between these?
Ans: Fully-Functional Dependency
An attribute is fully functional dependent on another attribute, if it is functionally dependent on
that attribute and not on any of its proper subset. For example, an attribute Q is fully functional
dependent on another attribute P, if it is functionally dependent on P and not on any of the proper
subset of P.
Let us see an example:
Table: ProjectCost
ProjectID Project Cost
001 1000
002 5000