The GATE Grind

GATE 2026 DA – Question 59

Database Management and Warehousing · Relational algebra, tuple calculus and SQL · 2 marks · Numerical answer

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: PQR
P1Q1R1
P2Q2R2
P3Q3R2
Y: PS
P110
P115
P220
P31

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.