Evaluating an SQL subquery and MIN aggregate
SQL & Queries

Answer & solution
Official answer: 26
Approach: Evaluate the inner join and filter to get a set of player IDs, then apply the outer aggregate only to those players.
The condition C.cname='Mark' selects coach row cid=102. Joining on T.cid=C.cid selects team tid=10, because that is the team coached by 102. Joining membership on M.tid=T.tid then selects the rows (1,10) and (3,10), so the subquery returns player IDs {1,3}.
The outer WHERE P.pid IN (...) retains Jasprit, age 31, and Ishan, age 26. MIN over those two ages is 26, which is the returned value.
Atharva’s age 24 is smaller overall but belongs to team 30 coached by Trevor; the predicate removes that row before MIN is computed. Axar likewise belongs to team 20 coached by Ricky. This demonstrates why aggregating over the entire player table before applying the team/coach restriction would be incorrect.










































































