Question

Consider the following database tables of a sports league.

player(pid,pname,age)
coach(cid,cname)
team(tid,tname,city,cid)
members(pid,tid)

An instance of the table and an SQL query are given.

player
pidpnameage
1Jasprit31
2Atharva24
3Ishan26
4Axar30
coach
cidcname
101Ricky
102Mark
103Trevor
team
tidtnamecitycid
10MIMumbai102
20DCDelhi101
30PKMohali103
members
pidtid
110
230
310
420
SELECT MIN(P.age)
FROM player P
WHERE P.pid IN (
    SELECT M.pid
    FROM team T, coach C, members M
    WHERE C.cname = 'Mark'
          AND T.cid = C.cid
          AND M.tid = T.tid
    )

The value returned by the given SQL query is ______ . (Answer in integer)

Official answer and solution
Official answer
26
From
Official GATE 2025 answer key

Solution

Evaluate the inner subquery to find all player IDs belonging to teams coached by 'Mark', then find the minimum age among those players.

  1. In the coach table, C.cname = 'Mark' matches cid = 102.
  2. In the team table, T.cid = 102 matches tid = 10 (MI).
  3. In the members table, M.tid = 10 matches pid values 1 and 3.
  4. In the outer query on player, pid = 1 (Jasprit) has age = 31 and pid = 3 (Ishan) has age = 26.
  5. Therefore, MIN(P.age) returns min⁡(31,26)=26\min(31, 26) = 26.
Final answer

26

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2025 Computer Science and Information Technology - Session 1 (CS1)
Question
55 of 65
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.