Skip to main content

GATE CSE 2025Databases › SQLVerified

GATE CSE 2025 PYQ: Consider the following database tables of a sports league. player ( pid , pname , age ) team ( tid , tname ,…

Consider the following database tables of a sports league.

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

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

playerpidpnameage1Jasprit312Atharva243Ishan264Axar30coachcidcname101Ricky102Mark103Trevorteamtidtnamecitycid10MIMumbai10220DCDelhi10130PKMohali103memberspidtid110230310420\begin{array}{} \textbf{player} \\ \begin{array}{|c|c|} \hline \textbf{pid} & \textbf{pname} & \textbf{age} \\ \hline \text{1} & \text{Jasprit} & \text{31} \\ \hline \text{2} & \text{Atharva} & \text{24} \\ \hline \text{3} & \text{Ishan} & \text{26} \\ \hline \text{4} & \text{Axar} & \text{30} \\ \hline \end{array} \\ \end{array} \quad \begin{array}{} \textbf{coach} \\ \begin{array}{|c|c|} \hline \textbf{cid} & \textbf{cname} \\ \hline \text{101} & \text{Ricky} \\ \hline \text{102} & \text{Mark} \\ \hline \text{103} & \text{Trevor} \\ \hline \end{array} \\ \end{array} \quad \begin{array}{} \textbf{team} \\ \begin{array}{|c|c|c|} \hline \textbf{tid} & \textbf{tname} & \textbf{city} & \textbf{cid} \\ \hline \text{10} & \text{MI} & \text{Mumbai} & \text{102} \\ \hline \text{20} & \text{DC} & \text{Delhi} & \text{101} \\ \hline \text{30} & \text{PK} & \text{Mohali} & \text{103} \\ \hline \end{array} \\ \end{array} \quad \begin{array}{} \textbf{members} \\ \begin{array}{|c|c|} \hline \textbf{pid} & \textbf{tid} \\ \hline \text{1} & \text{10} \\ \hline \text{2} & \text{30} \\ \hline \text{3} & \text{10} \\ \hline \text{4} & \text{20} \\ \hline \end{array} \\ \end{array}

  1. SELECT MIN (P.age)
  2. FROM player P
  3. WHERE P.pid IN (
  4. SELECT M.pid
  5. FROM team T, coach C, members M
  6. WHERE C.cname = 'Mark'
  7. AND T.cid = C.cid
  8. AND M.tid = T.tid
  9. )

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

    Answer

    26

    Approach

    Evaluate the nested SQL query from the inside out. First identify the coach id for 'Mark', then find the team coached by that coach, then find the players in that team, and finally compute the minimum age among those players.

    The inner query returns player IDs {1, 3}. The outer query computes the minimum age among those players: MIN(31, 26) = 26.

    Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.