GATE 2026 DA – Question 59
Let there be two relations $X$ and $Y$ as shown. $X$ has three columns $P$, $Q$ and $R$. $Y$ has two columns $P$ and $S$.
| X: P | Q | R |
|---|---|---|
| P1 | Q1 | R1 |
| P2 | Q2 | R2 |
| P3 | Q3 | R2 |
| Y: P | S |
|---|---|
| P1 | 10 |
| P1 | 15 |
| P2 | 20 |
| P3 | 1 |
Consider that the following tuple relational calculus expression is evaluated.
$$\{t \mid t \in X \wedge \exists z \in X\,(t[P] = z[P]) \wedge \exists m \in Y\,(m[P] = t[P] \wedge m[S] > 1)\}$$
The number of tuples that will be returned is __________ . (*Answer in integer*)
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: 2
Explanation
The condition $\exists z \in X\,(t[P] = z[P])$ is true for every tuple of $X$ (take $z = t$). The last condition asks for a tuple in $Y$ with the same $P$ and $S > 1$. For P1, Y has (P1, 10) and (P1, 15), so the tuple (P1, Q1, R1) is returned. For P2, Y has (P2, 20), so (P2, Q2, R2) is returned. For P3, the only Y tuple has $S = 1$, which is not greater than 1, so (P3, Q3, R2) is not returned. Two tuples are returned.