Armstrong`s Axioms

Functional Dependency
Young Chul Park
Database Systems Laboratory
Dept. of Computer Science
Kyungpook National University
Functional Dependency

Let R be a relation scheme and let V  R and W  R.

The functional dependency (FD) V → W holds on R
if in any legal relation r(R), for all pairs of tuples t1 and t2 in r such that t1[V]=t2[V],
it is also the case that t1[W]=t2[W].

e.q., student_id → student_name
(student_id, course_number, year) →grade

For a FD X →Y, X is called a determinant of Y.

A FD X → Y is trivial if Y  X.
e.q., A → A, AB → B are trivial FDs.
99-6-9
Kyungpook National University
2
Functional Dependency (cont.)

Y is partially dependent on X if X → Y and there exists Z  X such that Z → Y.
Otherwise, it is fully dependent.
e.q., AB → C and A → C.

Z is transitively dependent on X if X → Y and Y → Z.
In other words, a nontrivial chain of dependencies.
e.q., company_name → addr, addr → zip_code.

K is a super key of R if K → R.

Given a set F of FDs, we can prove that certain other FDs hold.
We say that such FDs are logically implied by F.
99-6-9
Kyungpook National University
3
Armstrong’s Axioms



Reflexive rule(재귀 규칙):
Augmentation rule(증가 규칙):
Transitivity rule(이행규칙):
IF Y  X, then X  Y
IF X  Y, then XW  YW
IF X  Y and Y  Z, then X  Z
Some additional rules:
 Union rule(연합 규칙) :
IF X  Y and X  Z, then X  YZ
 Decomposition rule(분해 규칙): IF X  YZ, then X  Y and X  Z
 Pseudotransitivity(가이행 규칙): IF X  Y and YW  Z, then XW  Z
Note : FD X  Y 의 왼쪽부분 X는 절대로 분해(decompose)하여서는 않된다.
99-6-9
Kyungpook National University
4
Closure
Let X be a set of attributes.
The closure of X (denoted by X+) is the set of all attributes functionally determined
by X under a set F of FDs.
/*Compute the closure of X under F */
Algorithm Compute_Closure(X, F)
{
result = X;
while (changes to result) do
for each FD Y  Z in F do {
if (Y is a subset of result) result = result  Z;
}
}
99-6-9
Kyungpook National University
5
Example
Let R = (A, B, C, G, H, I)
Let F = {A  B, A  C, CG  H, CG  I, B  H}
 A  H holds ? Yes. Why ?
A  B holds and B  H holds such that A  H holds by the transitivity rule.
 AG  I holds ? Yes. Why?
Compute (AG)+
result = AG
1st loop
result = ABG
(why? A  B)
result = ABCG
(why? A  C)
result = ABCGH (why? CG  H)
result = ABCGHI (why? CG  I)
2nd loop
no new attributes are added.  the algorithm terminates.
Now, I is in (AG)+
99-6-9
Kyungpook National University
6
Canonical Cover
Let F be a set of FDs.
The closure of F(denoted by F+) is the set of all FDs logically implied by F
A canonical cover Fc for F is a set of dependencies such that F logically implies all
dependencies in Fc and Fc logically implies all dependencies in F. Furthermore,
Fc must have the following properties :
Every FD X  Y in Fc contains no extraneous attributes in X
Every FD X  Y in Fc contains no extraneous attributes in Y
Each left hand side of a FD in Fc is unique.
Note the following :
– A in X is extraneous if Fc logically implies (Fc - {X  Y})  {(X - A)  Y}.
– A in Y is extraneous if Fc logically implies (Fc - {X  Y})  {X  (Y - A)}.
There can be several canonical covers for a set of FDs.
99-6-9
Kyungpook National University
7
Canonical Cover(cont.)
/* Compute the canonical cover Fc for F */
Algorithm Compute_Canonical_Cover(F)
{
Fc = F;
for each FD X  Y in Fc do {
decompose it into FDs each having one attribute on the right hand side.
}
gather the same FDs.
For each FD X  Y in Fc do {
if (Y is a subset of X+ calculated in Fc - {X  Y})
Fc = Fc - {X  Y}
}
union the same left hand side together
}
99-6-9
Kyungpook National University
8
Canonical Cover(cont.)

Let R = (A, B, C) and F = {A  BC, B  C, A  B, AB  C}
1. Fc = {A  B, A  C, B  C, A  B, AB  C}
2. Fc = {A  B, A  C, B  C, AB  C}
3. Fc = {A  B, B  C}

Let R = (A,B,C,D) and F = {A  B, AC  BCD}
1. Fc = {A  B, AC  B, AC  C, AC  D}
2. Fc = {A  B, AC  B, AC  C, AC  D}
3. Fc = {A  B, AC  D}
4. Fc = {A  B, AC  D}

Let R = (S, P, STATUS, CITY, QTY) and
F = {SP  ST | CITY | QTY, S  ST | CITY, CITY  ST}
1. Fc = {SP  ST, SP  CT, SP  QT, S  ST, S  CT, CT  ST}
2. Fc = {SP  ST, SP  CT, SP  QT, S  ST, S  CT, CT  ST}
3. Fc = {SP  QT, S  ST, S  CT, CT  ST}
4. Fc = {SP  QT, S  ST, S  CT, CT  ST}
99-6-9
Kyungpook National University
9
Normal Forms
Young Chul Park
Database Systems Laboratory
Dept. of Computer Science
Kyungpook national University
First Normal Form(1NF)
A relation scheme R is in 1NF if the domains of all attributes of R are atomic.

A domain is atomic if elements of the domain are considered to be indivisible units.
e.g.,
STUDENT(NAME,
SEX)
: Not in 1NF
----------------------------------{peter, john, david}
male
{anna, marry}
female

STUDENT(NAME,
SEX)
----------------------------------peter
male
john
male
david
male
anna
female
marry
female
: in 1NF
Note that the Domain of each Attribute of R-DBMS supports only the types that are specified in
the R-DBMS and does not support (1) Collection and (2) User defined data types (i.e.,
composite attribute). OR-DBMS and OO-DBMS support them.
99-6-9
Kyungpook National University
11
Motivation of Normal Forms

Let STDENT(s_id, s_name, year, dept_id, dept_name)
Let F = {s_id  s_name | year | dept_id | dept_name, dept_id  dept_name}

Fc = {s_id  s_name | year | dept_id, dept_id  dept_name}
Key = s_id
Upon key s_id,
s_name, year and dept_id are fully dependent; and
dept_name is transitively dependent.
What problems are in scheme STUDENT ?
Redundancy(중복) : Storage overhead
Update Anomaly(변경 이상): Insertion(삽입), Deletion(삭제), Modification(갱신)
Solution 
STUDENT(s_id, s_name, year, dept_id),
DEPARTMENT(dept_id, dept_name)
ER Model : STUDENT --n--< WORKS_FOR >--1--DEPARTMENT




99-6-9
Kyungpook National University
12
Motivation of Normal Forms (cont.)

Let STUDENT(id, name, addr, course, year, grade)
Let F = {id  name | addr, (id, course, year)  grade}

Fc = {id  name | addr, (id, course, year)  grade}
Key = (id, course, year)
Upon Key (id, course, year)
grade is fully dependent; name and addr are partially dependent.
What problems are in scheme STUDENT?
(1) Redundancy : 매 수강 과목마다 학생의 이름과 주소가 기록되어야 함.
(2) Update Anomaly :
E.g., Insertion Anomaly : 수강과목이 없으면 학생정보를 기록할 수 없다.
We cannot insert < 37, Y.C.Park, Taegu, NULL, NULL, NULL>
Why?  violates the Entity Integrity Constraint



Solution  STUDENT(id, name, addr), GRADE(id, course, year, grade)
ER Model : STUDENT --m--< GRADE >--n-- COURSE
99-6-9
Kyungpook National University
13
Motivation of Normal Forms(cont.)

Let R = (S, P, STATUS, CITY, QTY)
Let F = {SP  ST | CITY | QTY, S  STATUS | CITY, CITY  STATUS}

Fc = {SP  QTY, S  CITY, CITY  STATUS}
Key = (S, P)
Upon Key (S, P), QTY is fully dependent, CITY is partially dependent, STATUS is transitively dependent.
What problems are in scheme R?
Partial and transitive dependencies cause the following problems:
1. Redundancy: A city for a supplier may appear in multiple tuples.
2. Update Anomaly
2.1 Insertion Anomaly.
We cannot record the city of a supplier until the supplier supplies something.
Why?  violates the Entity Integrity Constraint.
2.2 Deletion Anomaly.
Deletion of the last tuple for a supplier loses its city.



Solution  SUPPLIES(S, P, QTY), SUPPLIER(S,CITY), CITYSTATE(CITY, STATUS)
ER Model : Part --m--< SUPPLIES >--n-- SUPPLIER --n --< ADDR >--1--CITYSTATE
99-6-9
Kyungpook National University
14
2NF, 3NF, BCNF


A relation scheme R is in 2NF with respect to a set of FDs F
if it is in 1NF and
none of its nonprime attributes is partially dependent upon any key in R.
A relation scheme R is in 3NF
if whenever X  A holds in R and A is not in X,
then either X is a superkey for R, or A is a prime attribute.
If X  A violates 3NF , then either
1. X is a proper subset of a key (a partial dependency) or
2. X is a proper subset of no key (a transitive dependency).

A relation scheme R with dependencies F is said to be in BCNF
if whenever X  A holds in R, and A is not in X, then X is a superkey for R.

Note that 3NF and BCNF are free from insertion and deletion anomalies and redundancies.
99-6-9
Kyungpook National University
15
Decomposition

Let R be a relation scheme and F be a set of FDs on R.
Let R1 and R2 form a decomposition of R.
This decomposition is a lossless-join decomposition if at least one of the
following FDs are in F+.
1. R1  R2  R1
2. R1  R2  R2

Let F be a set of FDs on scheme R and
let R1, R2, …, Rn be a decomposition of R.
Let F’ = F1  F2  …  Fn.
If F’+ = F+, we say that it is a dependency-preserving decomposition.

Redundant information
The lack of redundancy is desirable. The degrees to which we can achieve this
lack of redundancy is represented by several normal forms.
99-6-9
Kyungpook National University
16
Example

Let R = (A, B, C, D)
Let F = {A  CD}


Key = (A, B)
Note that A is not a superkey.
By using A  CD,
R is decomposed into R1 = (A, C, D) and R2 = (A, B).
Now R1 and R2 are in BCNF.

Lossless-Join (Yes), Dependency-Preserving (Yes)

In practice, simply remove B from R, then R is OK.

99-6-9
Kyungpook National University
17
BCNF with Lossless-Join Decomposition
Algorithm BCNF with Lossless-Join Decomposition
{
result = {R};
done = FALSE;
compute F +;
while (not done) do {
if (there is a scheme Ri in result that is not in BCNF){
Let X  Y be a nontrivial FD that holds on Ri such that
X  Ri is not in F+, and X ^ Y = {};
result = (result - Ri)  (Ri - Y)  (X, Y);
} else
done = TRUE;
}
}
99-6-9
Kyungpook National University
18
Example

Let R = (A, B, C, D, E, F)
Let F = {A  BC, D  AF}

Key = (D,E)
Note that A and D are not superkeys.
By using A  BC, R is decomposed into R1 = (A, B, C) and R1’ = (A, D, E, F).
 By using D  AF, R1’ is decomposed into R2 = (A, D, F) and R3 = (D, E).
 Now, R1(A,B,C), R2(A,D,F), and R3(D,E) are in BCNF.



Lossless-Join (Yes), Dependency-Preserving (Yes)
In practice, delete E from R, then
ER Model : R1(A, B, C)-- 1 --<relationship> -- n -- R2(D, F)
99-6-9
Kyungpook National University
19
Example

Let R = (S, P, STATUS, CITY, QTY)
Let F = {(S, P)  STATUS | CITY | QTY, S  STATUS | CITY, CITY  STATUS}

Key = (S, P)
Fc = {(S, P)  Qty, S  CITY, CITY  STATUS}
Note that S and CITY are not superkeys.


Scheme 1
1. By using CITY  STATUS, R is decomposed into
R1 = (CITY, STATUS) and R1’ = (S, P, CITY, QTY)
2. By using S  CITY, R1’ is decomposed into
R2 = (S, CITY) and R3 = (S, P, QTY)
3. Now R1, R2, and R3 are in BCNF.
4. Lossless-Join (Yes), Dependency-Preserving (Yes)
5. ER Model : Part(P)--m--< SUPPLIES( QTY) >--n-- SUPPLIER(S) --n--<ADDR >--1-- CITYST(CT, ST)

Scheme 2
1. By using S  CITY, R is decomposed into R1 = (S, CITY) and R1’ = (S, P, STATUS, QTY)
2. By using SP  QTY, R1’ is decomposed into R2 = (S, P, QTY) and R3 = (S, P, STATUS)
3. Now R1, R2 and R3 are in BCNF.
4. Lossless-Join (Yes), Dependency-Preserving (No)
Note : CITY’s very own STATUS.

99-6-9
Kyungpook National University
20
Example

Let R = (CITY, STREET, ZIP)
Let F = {ZIP  CITY, (CITY, STREET)  ZIP}

Candidate Keys = {(CITY, STREET), (STREET, ZIP)}
R is in 3NF but not in BCNF.
Note that ZIP is not a candidate key.
By using ZIP  CITY,
R is decomposed into R1 = (CITY, ZIP) and R2 = (STREET, ZIP)
Now R1 and R2 are in BCNF.
 Lossless-Join (Yes), Dependency-Preserving (No)
Why? In R1 : ZIP  CITY, in R2 : no FD.
 So, we cannot preserve (CITY, STREET)  ZIP.
 Note that not every BCNF decomposition is dependency-preserving.

99-6-9
Kyungpook National University
21
3NF v.s. BCNF

FDs that satisfy 3NF but violate BCNF.
<== something about the structure of the real world that is of no use to
the database designer

ZIP  CITY is TRUE but not really useful.
We want to store zip codes for addresses.

Lesson : Take important FDs only.

Let R = (CITY, STREET, ZIP)
Let F = {(CITY, STREET)  ZIP}
Candidate Keys = {(CITY, STREET)}
R is in 3NF and also in BCNF.

99-6-9
Kyungpook National University
22
3NF with Dependency-preserving and Lossless-Join Decomp.
Algorithm 3NF with Dependency-preserving and Lossless-Join Decomposition
{
Fc = a canonical cover for F ;
i=0;
for each FD X  Y in Fc do {
if (none of the schemes Rj, 1 <= j <= i, contains XY) {
i=i+1;
Ri = XY ;
}
}
if (none of the schemes Rj, 1 <= j <= i , contains a candidate key for R) {
i=i+1;
Ri = any candidate key for R ;
}
return(R1, R2, , Ri) ;
}

99-6-9
Note : To generate the minimal number of relations, we do the following:
For any two FDs X  Y and V  W in Fc
if XY  VW
then generate relation R’(VW) but do not generate R’’(XY).
Kyungpook National University
23
Example

Let R = (A, B, C, D)
Let F = {C  AD, AB  C}

Fc = {C  AD, AB  C }
Candidate Keys = {AB, BC}
Nonprime attributes = {D}
R is not in 3NF

Note that there is one inclusion relationship: {CA}  {ABC}
Therefore, we generate relationships for FDs: F’ = {C  D, AB  C}
By using C  D, R1 = (C, D)
By using AB  C, R2 = (A, B, C)



99-6-9
Kyungpook National University
24
Example

Let R = (A, B, C, D, E, F)
Let F = {B  AC, D  AE}

Fc = {B  AC, D  AE}
Candidate Keys = {BDF}
Nonprime attributes = {ACE}
R is in 1NF but not in 2NF.

Note that there is not any inclusion relationship.
By using B  AC, R1 = (A, B, C)
By using D  AE, R2 = (A, D, E)
A candidate key BDF : R3 = (B, D, F)



99-6-9
Kyungpook National University
25
Example

Let R = (A, B, C, D)
Let F = {AB  C, AC  D}

Fc = {AB  C, AC  D}
Candidate Keys = {AB}
Nonprime attributes = {CD}
R is in 2NF but not in 3NF.
Why?  No partial dependency, but there is a transitive dependency :
AB  AC  D

Note that there is not any inclusion relationship.
By using AB  C, R1 = (A, B, C)
By using AC  D, R2 = (A, C, D)


99-6-9
Kyungpook National University
26
Goal with Functional Dependencies


99-6-9
It is always possible to obtain 3NF design without sacrificing a
lossless-join or dependency preservation
Goal :
if BCNF with lossless-join and dependency preservation
else 3NF with lossless-join and dependency preservation
( 1NF ( 2NF ( 3NF ( BCNF ) ) ) )
Kyungpook National University
27
Multivalued Dependency

RDBMS does not support multi-valued attributes.

Problem Domain
1 : N relationship
M : N relationship
Weak Entity Type
Multi-valued Attribute

Solution
ER diagram ==> ER to Relational Mapping

Note that ORDBMS and OODBMS support collections as their attributes.
Collection type: set, bag(multi-set), list, array, dictionary.
99-6-9
Kyungpook National University
28
Multivalued Dependency
FRIENDS(s_id, s_name, friends)
FRIEND(s_id, s_name, friend)
------------------------------------------------------------------------35 kim
{peter, john, david}
35
kim
peter
20 park
{anna, marry}
35
kim
john
35
kim
david
 Not in 1NF
20
park
anna
20
park
marry
s_id  s_name, s_id  friends
F = {s_id  s_name}
Key = (s_id, friend)
 in 1NF but not in 2NF
 Solution  STUDENT(s_id, s_name), FRIENDS(s_id, friend)
ER model :
STUDENT(s_id,s_name)--1-- FRIENDSHIP == n == FRIENDS(name)]]
Note : WEAK Entity Type.
99-6-9
Kyungpook National University
29
Multivalued Dependency
CTX ( course, teacher,
text )
CTX ( course, teacher, text )
--------------------------------------------------------------------------20
{kim,lee}
{A, B, C}
20
kim
A
52
{park,choi,kim} {E, F}
20
kim
B
20
kim
C
20
lee
A
20
lee
B
20
lee
C
52
park
E
52
park
F
52
choi
E
52
choi
F
52
kim
E
52
kim
F
course  teacher,
F={}
course  text
Key = (course, teacher, text)
 in BCNF but the necessary
information is not held.
 Solution  CT(course, teacher), CX(course, text)
ER model :
TEACHER m  CT  n COURSE m CX  n  TEXT
99-6-9
Kyungpook National University
30
Multivalued Dependency
PMF ( project, member, friends )
---------------------------------10
kim
{peter, john, lim}
lee
{whang, david}
30
park {anna, marry}
choi {brook, hank}
kim
{peter, john, lim}
PMF ( project, member, friend )
-------------------------------10
kim
peter
10
kim
john
10
kim
lim
10
lee
whang
10
lee
david
30
park
anna
30
park
marry
30
choi
brook
30
choi
hank
30
kim
peter
30
kim
john
30
kim
lim
project  member, member  friends
F={}
Key = (project, member, friend)
 in BCNF but the necessary
information is not held.
 Solution  PM(project, member), MF(member, friend)
ER model :
PROJECT m PM n EMPLOYEE 1FD==m ==[[FRIEND]]
99-6-9
Kyungpook National University
31
Multivalued Dependency








99-6-9
Let LCST(loan_number, customer_name, street, city)
If a customer can have at most one address, then
customer_name  street | city
However, if a customer can have multiple addresses (i.e., a set of addresses),
then cust_name  street | city
does not hold anymore.
Instead, we have a multivalued dependency
cust_name  street city.
e.g., <l1, c1,{(s1, ct1), (s2, ct2)}>
If customer c1 has two loans, say l1 and l2, and two addresses, say (s1, ct1)
and (s2, ct2), then < {l1, l2}, c1, {(s1, ct1), (s2, ct2)} >
MVD = {cust_name  loan_number and cust_name  street city}.
Solution  CL(customer_name, loan_number), CA(customer_name,street,city)
ER Model : LOAN --n-- < CL > --1-- CUSTOMER --1--<< CAR >>==n== [[CA]]
Seems not so practical in real world. It is also a weak entity type.
Kyungpook National University
32
Multivalued Dependency : Definition
Let R be a relation scheme and let X  R and Y  R.
 The multivalued dependency X  Y holds on R if in any legal relation
r(R), for all pairs of tuples t1 and t2 in r such that t1[X] = t2[X], there
exists tuples t3 and t4 in r such that :
t1[X] = t2[X] = t3[X] = t4 [X]
t3[Y] = t1[Y]
t3[R-Y] = t2[R-Y]
t4[Y] = t2[Y]
t4[R-Y] = t1[R-Y]
 X  Y is trivial if Y  X or X  Y = R.
 Let D denote a set of functional and multivalued dependencies. The
closure D+ of D is the set of all functional and multivalued
dependencies logically implied by D.

99-6-9
Kyungpook National University
33
Theory of Multivalued Dependency
1. Reflexivity rule.
If X is a set of attributes and Y  X, then X  Y holds.
2. Augmentation rule.
If X  Y holds and Z is a set of attributes, then ZX  ZY holds.
3. Transitivity rule.
If X  Y holds and Y  Z holds, then X  Z holds.
4. Complementation rule.
If X  Y holds, then X  R  Y  X holds.
5. Multivalued augmentation rule.
If X  Y holds and Z  R and P  Z, then ZX  PY holds.
6. Multivalued transitivity rule.
If X  Y holds and Y  Z holds, then X  Z  Y holds.
7. Replication rule.
If X  holds, then X  Y.
8. Coalescence rule.
If X  Y holds and Z  Y and there is a P such that P  R and P  Y = 
P  Z, then X  Z holds.
99-6-9
Kyungpook National University
34
Some convenient rules

Multivalued union rule.
If X  Y holds and X  Z holds, then X  YZ holds.
 Intersection rule.
If X  Y holds and X  Z holds, then X  Y  Z holds.
 Difference rule.
If X  Y holds and X  Z holds, then X  Y  Z holds and X  Z  Y
holds.
Note that A  BC does not mean the followings hold : A  B and A  C.
Note the following :
Given a relation R(A,B,C), A  B holds if and only if A  C also holds. MVDs
always go together in pairs in this way. For this reason, it is common to represent
both in a single statement, using the notation A  B | C.
e.g. CTX( course, teacher, text )
if course  teacher
then course  teacher | text.
99-6-9
Kyungpook National University
35
Fourth Normal Form



99-6-9
A relation scheme R is in 4NF with respect to a set D of functional and
multivalued dependencies if for all multivalued dependencies in D+ of
the form X  Y, where X  R and Y  R, at least one of the following
hold:
(1) X  Y is trivial multivalued dependency.
(2) X is a superkey for scheme R.
A database design is in 4NF if each member of the set of relation
schemes comprising the design is in 4NF.
Every 4NF scheme is in BCNF.
Kyungpook National University
36
Fourth Normal Form
Algorithm 4NF_Decomposition with Lossless-Join
{
result = {R} ;
done = FALSE ;
compute F+ ;
while ( not done ) do {
if (there is a scheme Ri in result that is not in 4NF) {
let X  Y be a nontrivial MVD that holds on Ri
such that X  Ri is not in F+, and X ^ Y = { } ;
result = (result - Ri)  (Ri - Y)  (X, Y) ;
} else
done = TRUE ;
}
}
99-6-9
Kyungpook National University
37
Decomposition



99-6-9
Let R be a relation scheme and D a set of of functional and multivalued
dependencies on R. Let R1 and R2 form a decomposition of R. This
decomposition is a lossless-join decomposition if and only if at least one of the
following MVDs is in D+ :
(1) R1  R2  R1
(2) R1  R2  R2
Let R be a relation scheme and let R1, R2, , Rn be a decomposition of R. The
restriction of D to Ri is the set Di, consisting of :
1. All functional dependencies in D+ that include only attributes of Ri
2. All MVDs of the form X  Y  Ri, where X  Ri and X  Y is in D+.
A decomposition of scheme R into schemes R1, R2, , Rn is a dependencypreserving decomposition with respect to a set D of functional and multivalued
dependencies if every set of relations r1(R1), r2(R2), , rn(Rn) such for all i, ri
satisfies Di, there exists a relation r(R) that satisfies D and for which ri = Ri (r)
for all i.
Kyungpook National University
38
Example







99-6-9
Let R = (A, B, C, G, H, I)
Let D = {A  B, B  HI, CG  H}
By applying A  B on R, R1(A,B) and R1’(A,C,G,H,I).
By applying CG  H on R1’, R2(C,G,H) and R2’(A,C,G,I).
By applying A  I on R2’, R3(A,I) and R4(A,C,G).
Why ?
from A  B and B  HI, we get A  HI.
from A  HI  R2’(A,C,G,I), we get A  I.
Lossless-join decomposition (Yes), dependency-preserving decomposition (No).
B  HI is not preserved.
Can you make a real example with this complicate dependencies ???
Kyungpook National University
39
Goal with Multivalued Dependencies


99-6-9
Goal : 4NF with lossless-join and dependency preservation.
When we cannot achieve the above goal,
if BCNF with lossless-join and dependency preservation
else 3NF with lossless-join and dependency preservation.
( 1NF ( 2NF ( 3NF ( BCNF ( 4NF ) ) ) ) )
Kyungpook National University
40
Some Comments
(case 1) SPJ == SP join PJ
S ----< SP > ---- P ---- < PJ > ---- J
Note : in SPJ, S  P and P  J
(case 2) SPJ != SP join PJ join SJ
S --------------< SP > -------------- P
|
|
< SJ >
< PJ >
|
|
|---------------- J -------------------|
(case 3) No comment
S -------------- < SP > -------------- P
|
|
J
99-6-9
Kyungpook National University
41
Some Comments

BE SMART !!! TAKE IT EASY !!!
IF YOU MAKE DEPENDENCIES SO COMPLICATE, YOU MUST BE WRONG !!!
 Note that in the relational database, only the following constraints can be given
to a table as far as dependencies are concerned :
1. Entity integrity constraint (through PRIMARY KEY)
2. Candidate key constraints (through UNIQUE)
3. Null Constraint (through NULL and NOT NULL)
4. Referential integrity constraint (through FOREIGN KEY)
 Always make the ER diagram first. Then most of the problems can be solved.
You might have only functional dependencies in a table and the left hand side of
the FD might be the primary key of the table.
 Be sure to take only important FDs only.
99-6-9
Kyungpook National University
42
Example








99-6-9
Let DEPARTMENT(dept_number, dept_name, manager_id) ;
In the real world,
dept_name is human readable, e.g., Computer Science, Mechanical Engineering.
dept_number (or dept_code) is used just for the office automation. It is not human friendly.
manager_id is the identifier of the manager (the man who is one of the FACULTY member in
our university). It is also used for the office automation.
In this environment,
dept_number is unique in our university.
dept_name is also unique in our university.
F = {dept_number  dept_name | manager_id, dept_name  dept_number}
Candidate keys = {(dept_number), (dept_name)}
Then DEPARTMENT is in BCNF.
Primary key = dept_number, A candidate key = dept_name.
Why? dept_number is used just for the office automation and it is also used as a joining
attribute with other tables, for instance, STUDENT(st_id, st_name, addr, dept_number) and
FACULTY(fc_id, fc_name, rank, working_dept).
ER Model
n
1
1
1
STUDENT -------------- < Enroll> -------- DEPT ------- < Manager> ---------FACULTY
|
1
n
|
| ------------ < Works > -------------- |
Kyungpook National University
43
Questions
RDBMS를 이용한 데이타베이스의 설계에서 multivalued dependency가
발생하는 원인을 설명하고 이를 해결하는 기본적인 방법들을 제시하시
오.
 2NF를 만족하지만 3NF를 만족하지 않는 예를 보이고 이 설계가 지니는
문제점들을 예를 들어 보이고 이를 3NF를 만족하도록 변경하시오.

99-6-9
Kyungpook National University
44