Reshaping — pivot & unpivot
Exercise · SQL & Querying

Predict, then run it

Predict the output

tiles(project, color, n) = (m,red,3),(m,blue,2),(m,green,4); colors are open-ended. Return long form so every colour survives:

SELECT project, color, SUM(n) AS n FROM tiles GROUP BY project, color ORDER BY project, color;

Predict the exact output.