GATE CS 2025 · Set 1 · SQL Queries

NAT · 2 marks · Problem DBMS-SQL-0030

Consider the following database tables of a sports league: player(pid, pname, age), team(tid, tname, city, cid), coach(cid, cname) and members(pid, tid). An instance of each table is given below.\[\begin{array}{c} \textbf{player} \\ \begin{array}{|c|l|c|} \hline \text{pid} & \text{pname} & \text{age} \\ \hline 1 & \text{Jasprit} & 31 \\ \hline 2 & \text{Atharva} & 24 \\ \hline 3 & \text{Ishan} & 26 \\ \hline 4 & \text{Axar} & 30 \\ \hline \end{array} \end{array} \qquad \begin{array}{c} \textbf{coach} \\ \begin{array}{|c|l|} \hline \text{cid} & \text{cname} \\ \hline 101 & \text{Ricky} \\ \hline 102 & \text{Mark} \\ \hline 103 & \text{Trevor} \\ \hline \end{array} \end{array}\]\[\begin{array}{c} \textbf{team} \\ \begin{array}{|c|c|l|c|} \hline \text{tid} & \text{tname} & \text{city} & \text{cid} \\ \hline 10 & \text{MI} & \text{Mumbai} & 102 \\ \hline 20 & \text{DC} & \text{Delhi} & 101 \\ \hline 30 & \text{PK} & \text{Mohali} & 103 \\ \hline \end{array} \end{array} \qquad \begin{array}{c} \textbf{members} \\ \begin{array}{|c|c|} \hline \text{pid} & \text{tid} \\ \hline 1 & 10 \\ \hline 2 & 30 \\ \hline 3 & 10 \\ \hline 4 & 20 \\ \hline \end{array} \end{array}\]The following SQL query is run on this instance:
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)

Numerical answer (NAT).

Solve it on GATE DA practice →More Relational Model & SQL problems

Show the worked solution\[\boxed{\text{Evaluate the inner query, then take MIN over the matching players}}\]Mark is coach \(102\), who coaches team \(10\) (MI). The members of team \(10\) are players \(1\) and \(3\).Their ages are \(31\) (Jasprit) and \(26\) (Ishan), so the query returns \(26\).Answer: 26

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com