Given two union compatible relations R1(A,B) and R2(C,D) what is the result of…
Given two union compatible relations R1(A,B) and R2(C,D) what is the result of the operation
R1⋈A=C∧B=DR2
Answer: D. R1∩R2 — A theta-join is defined as a selection over the Cartesian product: r ⋈_θ s = σ_θ(r × s). Apply this to R1(A,B) and R2(C,D) with condition A = C ∧ B = D: first…
- A.
R1∪R2
- B.
R1×R2
- C.
R1−R2
- D.
R1∩R2
Attempted by 291 students.
Show answer & explanation
Correct answer: D
A theta-join is defined as a selection over the Cartesian product: r ⋈_θ s = σ_θ(r × s).
Apply this to R1(A,B) and R2(C,D) with condition A = C ∧ B = D: first form the Cartesian product R1 × R2, then select the pairs that satisfy the equality conditions.
Selection step: σ_{A=C ∧ B=D}(R1 × R2) produces matched pairs where the values of A and B in R1 equal the values of C and D in R2.
Projection step: projecting the matched pairs onto attributes A and B gives π_{A,B}(σ_{A=C ∧ B=D}(R1 × R2)).
Because R1 and R2 are union-compatible (their corresponding attributes represent the same domains), this projection yields exactly the tuples present in both relations, i.e., R1 ∩ R2.
Therefore the join R1 ⋈_{A=C ∧ B=D} R2 is equivalent to the intersection R1 ∩ R2 (more precisely: π_{A,B}(σ_{A=C ∧ B=D}(R1 × R2)) = R1 ∩ R2). If attribute names differ, rename R2's attributes to A and B before taking the intersection.