Sorting & limiting
Exercise · SQL & Querying

Predict, then run it

Predict the output

kites(name, height) = (red,90),(blue,80),(green,80),(yellow,60). The podium by rank — ties at the boundary kept:

SELECT name, height FROM (SELECT name, height, RANK() OVER (ORDER BY height DESC) AS rnk FROM kites) WHERE rnk <= 2 ORDER BY height DESC, name;

Predict the exact output.