Professional Documents
Culture Documents
Chapter Outline
Slide 10- 2
Chapter Outline
Slide 10- 3
Slide 10- 4
Slide 10- 5
GUIDELINE 1:
Slide 10- 6
Self
explanatory
Slide 10- 7
Insertion anomalies
Deletion anomalies
Modification anomalies
Slide 10- 8
Update Anomaly:
Slide 10- 9
Insert Anomaly:
Conversely
Slide 10- 10
Delete Anomaly:
Slide 10- 11
Slide 10- 12
Slide 10- 13
GUIDELINE 2:
Slide 10- 14
GUIDELINE 3:
Relations should be designed such that their tuples will
have as few NULL values as possible
Attributes that are NULL frequently could be placed in
separate relations (with the primary key)
Slide 10- 15
GUIDELINE 4:
The relations should be designed to satisfy the lossless
join condition.
No spurious tuples should be generated by doing a
natural-join of any relations.
Slide 10- 16
Note that:
Slide 10- 17
B
2
0
0
2
r
A
1
1
1
2
2
B
2
2
0
0
2
C
3
4
4
1
3
r2
B
2
2
0
0
2
r'
A
1
1
1
1
2
2
2
B
2
2
0
0
0
0
2
C
3
4
4
1
3
C
3
4
4
1
4
1
3
Phantom records
Observation
Not all decompositions of a
table can be combined using
natural join to reproduce the
original table.
Slide 10- 18
r2
A
1
4
2
3
B
2
2
2
1
C
3
3
6
4
B
2
2
1
r = r1 r2
A
1
1
4
4
3
r1 =
A
1
4
3
ABC(r)
B
2
2
1
B
2
2
2
2
1
C
3
3
3
3
4
D
4
5
2
D
4
5
4
5
2
r2 =
C
3
3
4
C
3
3
4
r2
BCD(r)
B
2
2
1
C
3
3
4
D
4
5
2
Evaluate projections
r1= ABC(r) and r2 =
BCD(r)
Observation
Tables r2 and r2 are the same
however tuple <2,2,6> r1 but
not present in r1
Copyright 2007 Ramez Elmasri and Shamkant B. Navathe
Slide 10- 19
3.1
3.2
3.3
3.4
3.5
3.6
Normalization of Relations
Practical Use of Normal Forms
Definitions of Keys and Attributes Participating in Keys
First Normal Form
Second Normal Form
Third Normal Form
Slide 10- 20
Normalization:
Normal form:
Slide 10- 21
4NF
based on keys, multi-valued dependencies : MVDs;
5NF based on keys,
Join dependencies : JDs (Chapter 11)
Slide 10- 22
Denormalization:
The process of storing the join of higher normal form
relations as a base relationwhich is in a lower normal
form
Copyright 2007 Ramez Elmasri and Shamkant B. Navathe
Slide 10- 23
Slide 10- 24
Slide 10- 25
Disallows
composite attributes
Set-valued attributes
nested relations; a cell of an individual tuple is a
complex relation
Slide 10- 26
Remember
PackA(r)
and
UnpackA(r)
operators?
Slide 10- 27
Composite
attributes
Slide 10- 28
Definitions
Prime attribute: An attribute that is member of the primary key K
Left-Reduced or Full functional dependency: a FD Y Z
where removal of any attribute from Y means the FD does not
hold any more
Examples:
{SSN, PNUMBER} HOURS is a full FD since neither
SSN HOURS nor PNUMBER HOURS hold
{SSN, PNUMBER} ENAME is not a full FD (it is called a partial
dependency ) since SSN ENAME also holds
Slide 10- 29
Example
Let R=ABCD and F = { AB C, B D }. Here AB is a key.
C and D are non-prime. C is fully dependent on the entire
key AB, however D functionally depends on just part of the
key (B D). This is called a partial dependency.
Copyright 2007 Ramez Elmasri and Shamkant B. Navathe
Slide 10- 30
SID
Activity
Fee
Instructor
100
Basket Ball
200
Lebron
100
Golf
65
Arnold
200
Golf
65
Jack
300
Golf
65
Lebron
activity fee,
sid activity instructor
Slide 10- 31
Slide 10- 32
Slide 10- 33
Definition:
Given a relation scheme R, a subset X of R, an attribute A
in R, and a set of FDs F, A is transitively dependent
upon X in R if there is a subset Y of R with:
X Y, Y X and Y A under F and A XY.
Examples:
Schema (ABCD) and F = {A B, B AC, C D }
D is transitively dependent on A(and B) via C, however
C is not transitively dependent on A via B (B is prime).
Copyright 2007 Ramez Elmasri and Shamkant B. Navathe
Slide 10- 34
NOTE:
In X Y and Y Z, with X as the primary key, we consider
this a problem only if Y is not a candidate key.
When Y is a candidate key, there is no problem with the
transitive dependency .
E.g., Consider EMP (SSN, Emp#, Salary ).
Here, SSN Emp# Salary and Emp# is a candidate key.
Copyright 2007 Ramez Elmasri and Shamkant B. Navathe
Slide 10- 35
Slide 10- 36
Slide 10- 37
sname item is the primary key, all other attributes are non-prime.
Observe that saddress depends on part of the key (sname).
Likewise iname depends on part of the key (item)
Therefore SUPPLIER is not in 2NF.
Slide 10- 38
Definition:
(a) X is a superkey of R, or
(b) A is a prime attribute of R
Slide 10- 39
SID
Building
Fee
Manager
100
Fenn
300
Mr. T
400
Ali
400
Tyson
300
Key: { SID }
SIDBuilding
Building Fee
Building Mgr
200
Holiday Inn
Slide 10- 40
Example
Keys: { Sid Major, Sid Fname }
Sid Major Fname
Sid Fname Major
Fname Major
SID
MAJOR
FNAME
100
MATH
CAUCHY
100
PHYL
PLATO
200
MATH
CAUCHY
300
PHYS
NEWTON
400
PHYS
EINSTEIN
The relation is in 3NF but not in BCNF. Observe that Fname Major is
valid, but Fname is not a superkey.
Problem: Student 300 drops PHYS. We lose information that says
NEWTON is a PHYS advisor.
A solution: (SID, FNAME), (FNAME, MAJOR)
Copyright 2007 Ramez Elmasri and Shamkant B. Navathe
Slide 10- 41
Slide 10- 42
Slide 10- 43
Slide 10- 44
Slide 10- 45
Slide 10- 46