UNPIVOT describes a Query Language feature of some Relational Databases. The UNPIVOT feature converts columnar data into row data, and vice versa for the PIVOT feature.
Overview
UNPIVOT describes a Query Language feature of some Relational Databases. The UNPIVOT feature converts columnar data into row data, and vice versa for the PIVOT feature.
Databases that support PIVOT/UNPIVOT syntax:
- Oracle 11g+
- SQL Server 2005+
Alternative approaches
While MySQL does not have a UNPIVOT
function, this can be replicated using a SELECT
statement with UNION ALL
for each column.
Alternative meanings
UNPIVOT is also a feature of other applications such as Business Intelligence Query tools and some spreadsheets.