Docsity

Understanding Normalization in Database Systems: Redundancy, Decomposition, and Forms - Pr, Study notes of Deductive Database Systems

Toggle sidebar
bg1
11/13/2008
1
CSC 4480
Chapter 19: Normalization
Problems Caused By Redundancy
• redundant storage
• update anomaly
• insertion anomaly
• deletion anomaly
Decomposition
• Decompose schema R by replacing the
schema with two (or more) relation
schema that each contain a subset of R
and together include all attributes of R
and
together
include
all
attributes
of
R
.
• Two questions to ask repeatedly:
– do we need to decompose a relation?
– what problems does a given decomposition
cause?
Functional Dependencies
• the FD X→Y hold if, ∀t1, t2 in r:
If t1.X=t2.X then t1.Y=t2.Y
• Closure of a set of F is F+.
•
Armstrong
’
s axioms:
•
Armstrong s
axioms:
– Reflexivity: if X ⊇Y, then X →Y
– Augmentation: if X →Y then XZ →YZ
– Transitivity: if X →Y and Y →Z then X →Z
• If we take the original FDs and then apply the
axioms, we obtain the closure. (Theorem 1).
Boyce-Codd Normal Form
• For every FD X→A in F, one of following is
true:
–A ∈X (trivial)
X is a superkey
–
X
is
a
superkey
• Each attribute depends on the key, the
whole key, and nothing but the key.
Third Normal Form
• For every FD X→A in F, one of following is
true:
–A ∈X (trivial)
X is a superkey
–
X
is
a
superkey
– A is part of some key for R.
pf3

Partial preview of the text

Download Understanding Normalization in Database Systems: Redundancy, Decomposition, and Forms - Pr and more Study notes Deductive Database Systems in PDF only on Docsity!

CSC 4480

Chapter 19: Normalization

Problems Caused By Redundancy

• redundant storage

• update anomaly

• insertion anomaly

• deletion anomaly

Decomposition

• Decompose schema R by replacing the

schema with two (or more) relation

schema that each contain a subset of R

and together include all attributes of Rand together include all attributes of R.

• Two questions to ask repeatedly:

– do we need to decompose a relation?

– what problems does a given decomposition

cause?

Functional Dependencies

• the FD X→Y hold if, ∀ t1, t2 in r:

If t1.X=t2.X then t1.Y=t2.Y

• Closure of a set of F is F+.

• • Armstrong’s axioms:Armstrong s axioms:

  • Reflexivity: if X ⊇ Y, then X →Y
  • Augmentation: if X →Y then XZ →YZ
  • Transitivity: if X →Y and Y →Z then X →Z

• If we take the original FDs and then apply the

axioms, we obtain the closure. (Theorem 1).

Boyce-Codd Normal Form

• For every FD X→A in F, one of following is

true:

– A ∈X (trivial)

– X is a superkeyX is a superkey

• Each attribute depends on the key, the

whole key, and nothing but the key.

Third Normal Form

• For every FD X→A in F, one of following is

true:

– A ∈X (trivial)

– X is a superkeyX is a superkey

– A is part of some key for R.

(Desirable) Properties of

Decompositions

• Lossless-Join: we can recover the original

relation from the decomposed relations.

– Let R be a relation. Decompose into R 1 and

RR 2 2. The attributes in common must contain aThe attributes in common must contain a

key to either R 1 or R 2.

• Dependency-Preserving: we can enforce

each original FD by examining a single

decomposed table.

Decomposition into BCNF

• see algorithm top of p. 623.

• BCNF is more normalized than 3NF, but,

we can’t guarantee that we can generate a’t t th t t

BCNF decomposition that is also

dependency-preserving. But we can for

3NF.

Decomposition into 3NF

• The previous algorithm would generate

3NF. But we already said it is not DP.

• We will need to modify the algorithm.

• This requires the concept of “minimalThi i th t f “ i i l

cover for a set of FDs”.

Minimal Cover

• Formal definition p. 625.

• A minimal cover for a set F of FDs is a set of

dependencies that is minimal in two respects:

  • Every dependency is as small as possible; eachy p y p

attribute on the left side is necessary, and the right

side is a single attribute.

  • Every dependency in it is required for the closure to

equal F+^.

• An algorithm for obtaining a minimal cover is on

p. 626, followed by algorithms for 3NF.

Multivalued Dependencies

Course Teacher Book Physics Green Mechanics Physics Green Optics Physics Brown Mechanics Physics Brown Optics

• CTB is in BCNF

• Should be

decomposed into CT

and CB.

4NF

• A MVD X → → Y holds over R if, for every

legal R, each X value is associated with a

set of Y values, and this set is

independent of the values in otherindependent of the values in other

attributes.

• Definition of 4NF: For every MVD, one of

the following is true:

– Y⊆X or XY=R, or

– X is a superkey