Last Updated: May 3, 2026
Reporting queries often need to reshape data. Pivoting turns distinct row values into columns, producing a cross-tabulation where each column represents a category. Unpivoting does the reverse, converting columns back into rows.
Both transformations come up frequently in SQL interviews and in any job that involves building reports or dashboards.