Windows I — ranking & offsets
Exercise · SQL & Querying

Predict, then run it

Predict the output

castings(id, w) = weights 10,20,30,30,50,60,70. Bucket by weight range for the furnace schedule, so equal weights stay together:

SELECT w, CASE WHEN w < 40 THEN 1 WHEN w < 70 THEN 2 ELSE 3 END AS bucket FROM castings ORDER BY id;

Predict the exact output.