Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1) Suppose relation R(A,B,C) has the tuples: Using bag projection and intersecti

ID: 3870966 • Letter: 1

Question

1) Suppose relation R(A,B,C) has the tuples:

Using bag projection and intersection, compute PROJA,B(R) INTERSECT RENAMES(A,B)(PROJB,C(R)). Note that the renaming is only to give the two projections the same schema.

2) Let R(A,B,C) and S(A,B,C) be two relations, and no attributes can have null value. Determine whether each of the following equations always holds in which R, S, and all operations are interpreted to be sets and set-operations.

What if R, S, and all operations are bags and bag-operations? Please explain your answer in detail. (20 pts)

a). (R INTERSECT S) = (R JOIN S)

b). (((R - S) UNION (S - R)) INTERSECT (R INTERSECT S)) = EMPTYSET

c). DELTA(R) = GAMMA_{A,B,C}(R)

d). (R UNION S) = R

A B C 1 2 3 1 2 3 2 3 1 3 1 2 2 2 3 2 3 3

Explanation / Answer

1. PROJA,B(R) INTERSECT RENAMES(A,B)(PROJB,C(R)).

2. R(A,B,C) and S(A,B,C) be two relations, and no attributes can have null value.

a). (R INTERSECT S) = (R JOIN S) : It will hold true everytime, as INTERSECT is by considering complete tuple, where as Joins is considered on the basis of common attribute. Here we have all three attributes as common attribute. So join condition will be  R.A = S.A and R.B = S.B and R.C = S.C which is similar to INTERSECT.

b). (((R - S) UNION (S - R)) INTERSECT (R INTERSECT S)) = EMPTYSET : It will hold true everytime. As (R-S) and (S-R) are mutually exclusive relations

So ((R - S) UNION (S - R)) will give tuple which are not common to both, and (R INTERSECT S) -> It will give tuple which are common to both R and S. So there intersection is empty set.

c). DELTA(R) = GAMMA_{A,B,C}(R) : Delta will remove duplicates tuple from relation R.

d). (R UNION S) = R : It will not hold true everytime, as R UNION S will give relation which includes tuple from both R and S. So if relation R and S are not equal then their UNION will not be equal to R.

A B 1 2 2 3 3 1 2 3