Docsity

Homework 4 Solutions for Database Systems | CS 430, Assignments of Deductive Database Systems

Toggle sidebar
bg1
Homework 4 Solution
March 4, 2009
Question 1-7 and 9: 10 points/each. Question 8 a) and b): 5 points/each. Question
8 c) and d): 10 points/each.
1. (a) YES. X+=XYWZ
(b) No. (XW)+=XW, Z is not in there.
2. r satisfies AD →B, C →DE, CD →A, AE →B. But r does not satisfy A→B
since the first two tuples of r have the same values for A, but different values for
B.
3. (a) A+=ABEC
(b) (AE)+=ABEC
(c) (ADE)+=ABCDEI
4. To see that F and G are equivalent, we need to verify that every FD in F is in G+,
and vice versa. We first check if F ⊆G+: (i) A+=ACD, so A →C is in G+. (ii)
AC+
G=ACD, so AC →D is in G+. (iii) (E)+
G=ACDEH, so E →AD is in G+.
Next we verify if G ⊆F+: (i) (A)+
F=ACD, so A →CD is in F+. (ii) (E)+
F=
ACDE, so E →AHE is not in F+.
Thus F and G and NOT equivalent.
5. (a) Let F ={A →BC, B →C, AB →D}. We need to obtain an equivalent set
of FDs that satisfies the three properties of a minimal cover.
•Right side of each FD in F must ne a single attribute: so we replace F
by F1={A →B, A →C, B →C, AB →D}.
•No extraneous attributes on the left side. We first check if A can be
deleted from AB →D. We can do so if B →D follows from F1. Since
(B)+
F1=BC, the answer is NO.
We next check if B can be deleted from AB →D. We can do if A →
D follows from F1. Since (A)+
F1=ABCD, the answer is YES. Let F2
={A →BC, B →C, A →D}.
•No redundant FDs: A →C can be deleted from F2. Minimal cover =
{A →B, B →C, A →D}.
1
pf3

Partial preview of the text

Download Homework 4 Solutions for Database Systems | CS 430 and more Assignments Deductive Database Systems in PDF only on Docsity!

Homework 4 Solution

March 4, 2009

Question 1-7 and 9: 10 points/each. Question 8 a) and b): 5 points/each. Question 8 c) and d): 10 points/each.

  1. (a) YES. X+^ = XYWZ (b) No. (XW)+^ = XW, Z is not in there.
  2. r satisfies AD → B, C → DE, CD → A, AE → B. But r does not satisfy A→B since the first two tuples of r have the same values for A, but different values for B.
  3. (a) A+^ = ABEC (b) (AE)+^ = ABEC (c) (ADE)+^ = ABCDEI
  4. To see that F and G are equivalent, we need to verify that every FD in F is in G+, and vice versa. We first check if F ⊆ G+: (i) A+^ = ACD, so A → C is in G+. (ii) AC+ G = ACD, so AC → D is in G+. (iii) (E)+ G = ACDEH, so E → AD is in G+. Next we verify if G ⊆ F+: (i) (A)+ F = ACD, so A → CD is in F+. (ii) (E)+ F = ACDE, so E → AHE is not in F+. Thus F and G and NOT equivalent.
  5. (a) Let F ={A → BC, B → C, AB → D}. We need to obtain an equivalent set of FDs that satisfies the three properties of a minimal cover. - Right side of each FD in F must ne a single attribute: so we replace F by F 1 = {A → B, A → C, B → C, AB → D}. - No extraneous attributes on the left side. We first check if A can be deleted from AB → D. We can do so if B → D follows from F 1. Since (B)+ F 1 = BC, the answer is NO. We next check if B can be deleted from AB → D. We can do if A → D follows from F 1. Since (A)+ F 1 = ABCD, the answer is YES. Let F 2 = {A → BC, B → C, A → D}. - No redundant FDs: A → C can be deleted from F 2. Minimal cover = {A → B, B → C, A → D}.

(b) Let F = {A → C, AB → C, C → DI, EC → AB, EI → C}. We need to obtain an equivalent set of FDs that satisfies the three properties od a minimal cover.

  • We replace F by F 1 = {A → C, AB → C, C → D, C → I, EC → A, EC → B, EI → C}.
  • No extraneous attributes on left side: it can be checked tjat B can be deleted from AB → C. Let F 2 = {A → C, C → D, C → I, EC → A, EC → B, EI → C}
  • No redundant FDs: None of the FDs are redundant. Minimal Cover is {A → C, C → D, C → I, EC → A, EC → B, EI → C}
  1. (a) ρ is loss since AB ∩ BCD = B, and neither B → AB not B → BCD is true. (you can use chase algorithm too). (b) The initial table: A B C D E I a1 a2 a3 b1 b2 b a1 b4 b5 a4 b6 a b7 a2 b8 a4 a5 a b9 b10 a3 a4 a5 a By applying the three FDs, we obtain a tableau that has one row consisting entirely of a’s. Hence ρ is lossless.
  2. • No change if applying step 1.
  • We can check that F does not have any extraneous FDs.
  • For step 3, we need only consider AB → C. We can see that B is redundant by considering (A)+ F. Since (A)+ F = ABC, B is redundant. Thus, we replace AB → C by B → C to get the minimal cover {A → C, C → , A → B}. Unfortunately, this is not a minimal cover since the FD A → B is now extraneous.
  1. (a) IS is a candidate key since (i) (IS)+^ = IBO and S+^ = SD.

(b) IS is the only candidate key since neither I nor S appear in the right hand side if any FD. Therefore any candidate key will have to contain both I and S. But since IS forms a candidate key, it is the only candidate key. (c) One possible decomposition is obtained as follows: (d) We first find the minimal cover F = {S → D, I → B, IS → Q, B → O}. It turns that F is minimal. Thus {SD, IB, ISQ, BO} is required decom- position. Notice ISQ → BOISQD, hence the decomposition has lossless property.

  1. Let’s rewrite the relation scheme as R = EPBT and FDs as EP → T, P → B. E = EMP_ID, P = PROJECT, B = PROJECT_BUDGET, T = TIME_SPENT_BY_PERSON_ON_PROJECT.

(a) Since EP is the only candiddate key of R, both E and P are prime attributes while T and B are nonprime attributes.