Aggregation & GROUP BY
Exercise · SQL & Querying

Predict, then run it

Predict the output

looms(mill, wool, kg) = (north,merino,5),(north,alpaca,3),(south,merino,4). kg per mill plus the alphabetically-last wool type — resolve the bare column by aggregating it:

SELECT mill, MAX(wool) AS heaviest, SUM(kg) AS kg FROM looms GROUP BY mill ORDER BY mill;

Predict the exact output.