Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

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

Material Type: Assignment; Professor: Ray; Class: Database Systems; Subject: Computer Science; University: Colorado State University; Term: Spring 2009;

Typology: Assignments

Pre 2010

Uploaded on 11/08/2009

koofers-user-2am-2
koofers-user-2am-2 ๐Ÿ‡บ๐Ÿ‡ธ

10 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

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.