The GATE Grind

GATE 2025 CS (CS1) – Question 39

Databases · Relational Model: Relational Algebra, Tuple Calculus, SQL · 2 marks · Multiple choice

Consider two relations describing $teams$ and $players$ in a sports league:
- $teams(tid, tname)$: $tid$, $tname$ are team-id and team-name, respectively
- $players(pid, pname, tid)$: $pid$, $pname$, and $tid$ denote player-id, player-name and the team-id of the player, respectively

Which ONE of the following tuple relational calculus queries returns the name of the players who play for the team having $tname$ as 'MI'?

  1. $\{ p.pname \mid p \in players \wedge \exists t (t \in teams \wedge p.tid = t.tid \wedge t.tname = 'MI')\}$
  2. $\{ p.pname \mid p \in teams \wedge \exists t (t \in players \wedge p.tid = t.tid \wedge t.tname = 'MI')\}$
  3. $\{ p.pname \mid p \in players \wedge \exists t (t \in teams \wedge t.tname = 'MI')\}$
  4. $\{ p.pname \mid p \in teams \wedge \exists t (t \in players \wedge t.tname = 'MI')\}$

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (A) $\{ p.pname \mid p \in players \wedge \exists t (t \in teams \wedge p.tid = t.tid \wedge t.tname = 'MI')\}$

Explanation

The query must range p over players and join with teams on tid with tname='MI'. Only (A) does this. (B) and (D) use the wrong relations, and (C) omits the join condition.