#Trivial functional dependencies in a table
Haotian Wang
dependencies in a table Haotian Wang Table(a,b,c) Group 1: Left - - PowerPoint PPT Presentation
#Trivial functional dependencies in a table Haotian Wang Table(a,b,c) Group 1: Left part contains one attribute: subgroups:1.1 a a, 1.2 b b, 1.3 c c. G1= 3 1=3 Group 2: Left part contains two attributes: 2.1 ab a,
Haotian Wang
subgroups:1.1 a→a, 1.2 b→b, 1.3 c→c. G1= 3×1=3
2.1 ab→a, ab→b, ab→ab. 2.2 ac→a, ac→c, ac→ac. 2.3 bc→b, bc→c, bc→bc. G2=3×3=9
3.1 abc→a, abc→b, abc→c. abc→ab, abc→ac, abc→bc. abc→abc. G3=1×7=7 total=G1+G2+G3=19
How many elements in each subgroup? 1. G1=n×1
2 elements for n elements? # subgroups of group 2 =
𝑜 2 = 𝑜! 2!× 𝑜−2 !
How many elements in each subgroup? 3. G2= 𝑜
2 × 3
3 .
Suppose we have chosen attributes a,b,c. The functional dependency is like: abc→? What can “?” be ? We use 3-digit binary numbers to represent our choice. For each digit, “0” means we don’t choose, “1” means we choose. For example: 101 means we choose a, don’t choose b, choose c. “?” becomes “ac”. The functional dependency is abc→ac
a b c 0 (Don’t choose) 1 (Choose)
For normal numbers(decimal numbers). If it has three digits, there 103=1000 different numbers.(0 to 999) For binary numbers. Likewise, if it has three digits, there 23=8 different numbers. They are from 000 to 111.
There are 23-1 different choices in each subgroup of group 3. G3= 𝑜
3 × (23−1)
𝑗 × (2𝑗−1)
𝑜
𝐻𝑗=σ𝑗=1
𝑜 𝑜 𝑗 × (2𝑗 − 1)
𝑜 0 (𝑏0𝑐𝑜) + 𝑜 1 (𝑏1𝑐𝑜−1)+ …+ 𝑜 𝑗 (𝑏𝑗𝑐𝑜−𝑗)+…+ 𝑜 𝑜 (𝑏𝑜𝑐0)
𝑜 0 (201𝑜) + 𝑜 1 (211𝑜−1)+ …+ 𝑜 𝑗 (2𝑗1𝑜−𝑗)+…+ 𝑜 𝑜 (2𝑜10)
𝑜 𝑜 𝑗 × 2𝑗
𝑜 𝑜 𝑗 × 2𝑗 − 1 = σ𝑗=0 𝑜 𝑜 𝑗 × (2𝑗 − 1)
𝑜 𝑜 𝑗 × 2𝑗 − σ𝑗=0 𝑜 𝑜 𝑗 × 1𝑗= 3𝑜 − 2𝑜
For each attribute, it has three different choices:
(It can’t appear only in the answer part.)
Means “a” chose 1(no show), “c” chose 2(only in C), “b” and “d” chose 3(both).
the trivial functional dependencies we can get.
a b c d e 0 (No show) 1 (Only in C) 2 (Both A,C)
For table(a,b,c,d,e), numbers like 10101(ace→ ),or 00110(cd→ ) are illegal.
every digit can only be“0” or “1”, they are in fact binary numbers.) 2𝑜