4NF 5NF
4NF 5NF
4NF 5NF
Review
Narotama University
Review (cont.)
1NF
Make a separate table for each set of related attributes, and give each table a
primary key.
2NF
3NF
BCNF
Narotama University
4NF
Definition
1.
2.
Narotama University
Narotama University
1.
2.
Narotama University
1.
2.
Narotama University
Decompose Drinkers2
Drinkers3(name, phones)
Drinkers4(name, beersLiked)
Narotama University
MVD Example
Drinkers(name, addr, phones, beersLiked)
A drinkers phones are independent of the
beers they like.
10
Narotama University
Implied by namephones
If we have tuples:
name
sue a
sue a
sue a
sue a
11
Narotama University
Example
Drinkers(name, addr, phones, beersLiked)
with MVD Name phones. If Drinkers has
the two tuples:
name
sue
sue
addr phones
a
p1
b1
a
p2
b2
beersLiked
beersLiked
Example (contd)
13
Narotama University
Solution:
14
Narotama University
1NF
functional
dependencies
multivalued
dependencies
join
dependencies
15
Narotama University
ASSUMPTIONS
24-HOUR FLIGHT-TIMETABLE, ALL FLIGHTS EVERY DAY
ALL PLANES TAKE-OFF AND LAND (BUT DO NOT CRASH)
NO AIRPORT IS LANDING-ONLY & NO AIRPORT IS TAKE-OFF-ONLY
TTAB (ORG) = TTAB (DST)
THERE IS AT LEAST ONE TIME DELAY ENTRY FOR EVERY FLIGHT
SIMILARLY IN WEATHER REPORT HISTORY
IF NO TWO FLIGHTS CAN TAKE OFF AT THE SAME TIME IN THE SAME AIRPORT
WES CAN BE POSTED TO FLIGHT AND WEATHER@ORIGIN ELIMINATED
16
Narotama University
AWARD
UNIVERSITY
DISCIPLINE DEGREE
Old Town
Computing
BSc
Old Town
Mathematics
PhD
New City
Computing
PhD
Old Town
Computing
PhD
FROM
(NewCity teaches Computing) and (Computing is_read_for BSc)
IT DOES NOT FOLLOW
NewCity awards BSc for_reading Computing
17
Narotama University
AWARD
Computing
Mathematic s Mathematic s
New City
Computing
Computing
BS c
Old Town
BS c
PhD
Old Town
PhD
PhD
New City
PhD
DEGREE
Old Town
Computing
BS c
Old Town
Computing
PhD
Old Town
Mathematic s
PhD
New City
Computing
BS c
New City
Computing
PhD
spurious
tuple
18
DEGREE
Old Town
Computing
BS c
Old Town
Computing
PhD
Old Town
Mathematic s
PhD
New City
Computing
PhD
Narotama University
Join Dependency
JD * (R1, R2, R3, ..., Rm) holds in R iff R = join (R1, R2, R3, ..., Rm ), Ri - a projection of R
for
if
R1
R2
then
)
JD*(
holds for R
19
Narotama University
preventingillogicalconjunctionoffacts
if
JD* (
) holds for R
,
does not contain key
if
JD* (
JD* (
)
)
then R is in 5NF
20
Narotama University
AWARD
UNIVERSITY
DISCIPLINE
DISCIPLINE
DEGREE
UNIVERSITY
DEGREE
Old Town
Computing
Computing
BSc
Old Town
BSc
Old Town
Mathematics
Mathematics
PhD
Old Town
PhD
New City
Computing
Computing
PhD
New City
PhD
21
Narotama University
RANKING
NAME
CODE
TEACHING
RES EARCH
Old Town
P05
21
New City
C01
23
join dependencies
JD1 * ((NAME, CODE, TEACHING), (NAME, RESEARCH))
JD2 * ((NAME, CODE, RESEARCH), (NAME, TEACHING))
JD3 * ((NAME, CODE, TEACHING), (CODE, RESEARCH))
JD4 * ((NAME, CODE, RESEARCH), (CODE, TEACHING))
JD5 * ((NAME, CODE), (NAME, TEACHING), (CODE,RESEARCH))
.............................................................................................
all projections in JD1 - to JD5 are superkeys for RANKING 5NF
22
Narotama University
Summary
23
Narotama University
References
http://www.cs.sjsu.edu/~lee/cs157b/Spring09
Presentation/4NF_and_Multivalued_Dependency
_by_Kristina_Miguel.ppt
http://www.cs.sjsu.edu/faculty/lee/cs157/4N
F%20and%205NF.ppt
24
Narotama University