hw2 Sols
hw2 Sols
IMPORTANT:
• Upload a PDF of your answers to Gradescope by 11:59pm on Wednesday Sep 20, 2017.
• Plagiarism: Homework may be discussed with other students, but all homework is to be
completed individually.
• Typeset all your answers.
For your information:
• Graded out of 100 points; 4 questions total
• Rough time estimate: ≈1-4 hours (0.5-1 hours for each question)
Revision : 2017/10/22 09:40
1
15-445/645 (Fall 2017) Homework 2 Page 2 of 6
S X Y Z
m 20 T
m 10 F
o 30 T
n 30 T
o 20 T
Table 1: Legal instance of schema S for question 2.1
(a) Which of the following dependencies are violated by the instances of S in Table 1?
i. [2 points] Yes 2 No : X → Y is violated.
ii. [2 points] Yes 2 No : Z → X is violated.
iii. [2 points] 2 Yes No : Y → Z is violated.
iv. [2 points] 2 Yes No : XY → Z is violated.
v. [2 points] Yes 2 No : Y Z → X is violated.
vi. [2 points] Yes 2 No : XZ → Y is violated.
(b) [3 points] By only observing the instance of S in Table 1, can you identify the functional
dependencies that hold on schema S? Why?
2 Yes No
Homework 2 continues. . .
15-445/645 (Fall 2017) Homework 2 Page 3 of 6
Q → U (1)
U → V (2)
PQ → W ST (3)
SU → TR (4)
VT → RW (5)
R → W (6)
(a) [8 points] Which of the following is a minimum cover of the FD? Mark all that qualify;
if none, mark accordingly, and give your own. answer.
i. The given FDs (Eq 1-6), is a minimum cover already.
ii. {Q → U, U → V, P Q → S, SU → T, SU → R, V T → R, V T → W, R → W }
iii. {Q → U, U → V, P Q → S, SU → T, P Q → W, V T → R, P Q → T, R → W }
iv. {Q → U, U → V, P Q → S, SU → T, V T → R, R → W }
v. {Q → U, U → V, P Q → S, SU → T, SU → R, V T → R, P Q → T, R → W }
vi. none of the above - the cover is
Solution: iv
(b) Yes/No: Which of the following functional dependencies can be deduced, from the above
set of functional dependencies (Eq. (1)-(6))?
i. [3 points] Yes 2 No : Q → V
ii. [3 points] 2 Yes No : QU → R
iii. [3 points] Yes 2 No : SQ → T
iv. [3 points] Yes 2 No : SQ → W
v. [3 points] Yes 2 No : P Q → R
vi. [3 points] 2 Yes No : V T → Q
(c) [3 points] True or False: The attribute closure {Q}+ is {Q, U, V }.
True 2 False
(d) [3 points] True or False: The attribute closure {P Q}+ is {P, Q, W, S, T }.
2 True False
Grading info: It is {P, Q, R, S, T, U, V, W }.
Homework 2 continues. . .
15-445/645 (Fall 2017) Homework 2 Page 4 of 6
A→B
B → CD
E→F
Homework 2 continues. . .
15-445/645 (Fall 2017) Homework 2 Page 5 of 6
PQ → R (7)
PQ → S (8)
R → P (9)
S → Q (10)
Question 4 continues. . .
15-445/645 (Fall 2017) Homework 2 Page 6 of 6
(g) [8 points] Give a BCNF decomposition of E that is lossless, and has as few tables as
possible.
Solution: E1,1 =(P, R), E1,2 =(Q, S), E1,3 =(R, S)
Grading info: -5: BCNF decomposition with more than 3 tables
End of Homework 2