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

D Given two relational schemas R(ABC) and S(ABC), let r(R) and s(S) be the relat

ID: 3667769 • Letter: D

Question

D Given two relational schemas R(ABC) and S(ABC), let r(R) and s(S) be the relations (relation table or relation instance) corresponding to R and S respectively as the following: (60 points) R

A B C

a1 b1 c1

a3 b3 c3

S

A B C

a1 b1 c1

a2 b2 c2

a.Are table R and table S union compatible?

b. Please give the result of table R union table S.

c. Please give the result of table R intersect table S.

d. Please give the result of table R difference (minus) table S

. e. Please give the result of table S difference (minus) table R.

f. Is the operator difference (minus) commutative?

g. Is the operator difference (minus) associative?

h. Can the table R be joined with table S (natural join)? If the answer is yes, what is the result of the R natural join S?

i. What is the observation you could give by comparing the result of Question D.c. and D.h.?

j. Please give the result of the relational algebra expression: R – (R – S)

k. Is R – (R – S) equivalent to S - (S – R)?

l. What is the observation you could give from Question D.k?

Note: Please do not use SQL statement to get the answers.

Explanation / Answer

a) Yes, R and S are union compatible as they have same number of fields and of same type.

b) R union S =

a1 b1 c1

a3 b3 c3

a2 b2 c2

c) R intersection S =

a1 b1 c1

d) R minus S =

a3 b3 c3

e) S minus R =

a2 b2 c2

f) No,

g) No,

h) Yes, R can be joined with S as they have common fields. Result of their join is:

a1 b1 c1 a1 b1 c1

a3 b3 c3 a1 b1 c1

a1 b1 c1 a2 b2 c2

a3 b3 c3 a2 b2 c2

i) In the first operation, intersection of two sets is used which returns tuples common to both the table. While in other operation, join is performed which combines the attributes of two tables.

j) R-S = a3 b3 c3 as computed above

R - (R-S) =

a1 b1 c1

k) S - R is a2 b2 c2 as calculated above.

S - (S - R) =

a1 b1 c1

Both produce the same result.

l) It gives the intersection of both the tables.