Consider the following instance of relation: Number of tuples return by the…
Consider the following instance of relation:

Number of tuples return by the following query over given relations:
Πq (RxS) ⋂ ρp←x Πx(R ⋈q=x S)
Answer: 2 — tuples returned by the query: Answer: 2 tuples. Explanation: Compute the projection of the Cartesian product on attribute q. The Cartesian product R × S…
Attempted by 4 students.
Show answer & explanation
Correct answer: 2
tuples returned by the query:

Answer: 2 tuples.
Explanation:
Compute the projection of the Cartesian product on attribute q. The Cartesian product R × S repeats each Q value from R for every row of S, so projecting q yields the distinct Q values from R: {2, 3}.
Compute the join with condition q = x and then project x. Matching Q values in R with X values in S gives matches for 2 and 3, so projecting x yields {2, 3}. Renaming x to p produces a single-attribute relation with values {2, 3}.
Take the intersection of the two single-attribute relations. Both contain the values 2 and 3, so the intersection contains {2, 3}, which has 2 tuples.