Chapter 14 Slides
Chapter 14 Slides
Navathe
CHAPTER 14
Anomalies
n 1.3 Null Values in Tuples
n Insertion anomalies
n Deletion anomalies
n Modification anomalies
No_hours)
n Insert Anomaly:
n Cannot insert a project unless an employee is
assigned to a project.
Figure 14.3
Two relation
schemas
suffering from
update
anomalies. (a)
EMP_DEPT and
(b) EMP_PROJ.
n GUIDELINE 2:
n Design a schema that does not suffer from the
n GUIDELINE 3:
n Relations should be designed such that their
tuples will have as few NULL values as
possible
n Attributes that are NULL frequently could be
n GUIDELINE 4:
n The relations should be designed to satisfy the
lossless join condition.
n No spurious tuples should be generated by
be sacrificed.
n Property (b) is less stringent and may be
Figure 14.4
Sample states
for EMP_DEPT
and EMP_PROJ
resulting from
applying
NATURAL JOIN to
the relations in
Figure 14.2.
These may be
stored as base
relations for
performance
reasons.
relations
n FDs are constraints that are derived from the
with t1[K]=t2[K]
n Normalization:
n The process of decomposing unsatisfactory "bad"
relations by breaking up their attributes into
smaller relations
n The decomposition into several relations that
satisfy various definitions of normal forms, each
one more restrictive than the previous one.
n Normal form:
n Condition using keys and FDs of a relation to
certify whether a relation schema is in a particular
normal form.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 14- 32
Normalization of Relations (2)
n Denormalization:
n The process of storing the join of higher normal form
relations as a base relation—which is in a lower normal
form
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 14- 34
3.3 Definitions of Keys and Attributes
Participating in Keys (1)
Figure 14.10
Normalizing nested relations into 1NF.
(a) Schema of the EMP_PROJ relation
with a nested relation attribute PROJS.
Figure 14.3
Two relation
schemas
suffering from
update
anomalies. (a)
EMP_DEPT and
(b) EMP_PROJ.
Figure 14.11
Normalizing into 2NF and 3NF.
(a) Normalizing EMP_PROJ into
2NF relations. (b) Normalizing
EMP_DEPT into 3NF relations.
Figure 14.12
Normalization into 2NF
and 3NF. (a) The LOTS
relation with its
functional dependencies
FD1 through FD4.
(b) Decomposing into
the 2NF relations LOTS1
and LOTS2. (c)
Decomposing LOTS1
into the 3NF relations
LOTS1A and LOTS1B.
(d) Progressive
normalization of LOTS
into a 3NF design.
n Definition:
n Superkey of relation schema R - a set of attributes
S of R that contains a key of R
n A relation schema R is in third normal form (3NF)
if whenever a FD X → A holds in R, then either:
n (a) X is a superkey of R, or
n (b) A is a prime attribute of R
n LOTS1 relation violates 3NF because
Area → Price; and Area is not a superkey in
LOTS1. (see Figure 14.12).
Figure 14.12
Normalization into 2NF
and 3NF. (a) The LOTS
relation with its
functional dependencies
FD1 through FD4.
(b) Decomposing into
the 2NF relations LOTS1
and LOTS2. (c)
Decomposing LOTS1
into the 3NF relations
LOTS1A and LOTS1B.
(d) Progressive
normalization of LOTS
into a 3NF design.
Figure 14.13
Boyce-Codd normal form. (a) BCNF normalization of
LOTS1A with the functional dependency FD2 being lost in
the decomposition. (b) A schematic relation with FDs; it is
in 3NF, but not in BCNF due to the f.d. C → B.
Figure 14.14
A relation TEACH that is in 3NF
but not BCNF.