Reshaping — pivot & unpivot
Exercise · SQL & Querying

Predict, then run it

Predict the output

builds(puppet, act1_mins, act2_mins) = (alpha,8,8),(beta,5,9). Unpivot to one row per (puppet, act), carrying the act label:

SELECT puppet, 'act1' AS act, act1_mins AS mins FROM builds UNION ALL SELECT puppet, 'act2', act2_mins FROM builds ORDER BY puppet, act;

Predict the exact output.