Consider the following relation schemas: R(A, B), R2(A, B) and S(C, D) Which…

Consider the following relation schemas: R(A, B), R2(A, B) and S(C, D) 

Which of the following equalities is/are true? 

Answer: B. (R − R2) − R2) − R2 = R − R2Final answer: ((R − R2) − R2) − R2 = R − R2 is true; the other equalities are not generally true. (R − R2) − R2 = R — This is false in general. Subtracting R2…

  1. A.

    (R − R2) − R2 = R 

  2. B.

    (R − R2) − R2) − R2 = R − R2 

  3. C.

    ΠA(R ⋈B=C S) = ΠA(R) 

  4. D.

    (R-R2)-S = S 

Attempted by 5 students.

Show answer & explanation

Correct answer: B

Final answer: ((R − R2) − R2) − R2 = R − R2 is true; the other equalities are not generally true.

  • (R − R2) − R2 = R — This is false in general. Subtracting R2 twice does not restore the removed tuples; (R − R2) − R2 = R − R2. Example: R = {(a,1),(b,2)}, R2 = {(b,2)} gives (R − R2) − R2 = {(a,1)} ≠ R.

  • ((R − R2) − R2) − R2 = R − R2 — This is true. Once tuples in R2 are removed from R, further removals of the same set have no effect, so any number of repeated subtractions of R2 yields R − R2.

  • ΠA(R ⋈_{B=C} S) = ΠA(R) — This is false in general. The projection after a join can drop tuples from R whose join attribute has no matching tuple in S, so ΠA(R ⋈_{B=C} S) is at best a subset of ΠA(R). Example: R contains (a,1) but if S has no tuple with C = 1, the join yields no tuple with A = a, so the equality fails.

  • (R − R2) − S = S — This is false in general. The left-hand side is a subset of R and so cannot generally equal S. Example: R = {1,2}, R2 = {}, S = {2} gives (R − R2) − S = {1} ≠ {2}.

Summary: The only equality that always holds is repeated subtraction of the same relation producing the same result as a single subtraction.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Isro

Loading lesson…