Windows I — ranking & offsets
Exercise · SQL & Querying

Predict, then run it

Predict the output

repairs(shop, mins) = (east,30),(east,50),(west,40). Show each repair with how far its minutes sit from the shop's average — a GROUP BY can't keep the detail:

SELECT shop, mins, mins - AVG(mins) OVER (PARTITION BY shop) AS vs_avg FROM repairs ORDER BY shop, mins;

Predict the exact output.