Pivot/Unpivot (EN)

Concept

Operations for rotating data between rows and columns

Definition

Pivot transforms rows into columns, while Unpivot does the opposite and converts columns into rows. These operations are useful for reshaping data for reports or dashboards by adjusting data structures. Pivot/Unpivot operations are often combined with CASE statements for complex transformations and are particularly valuable for data preparation in analytical scenarios.

Data Flow

flowchart LR   A[Raw Data] --> B[Pivot/Unpivot Operation]   B --> C[Transformed Data]   C --> D[Report/Dashboard] 

In Context

  • Typically used together with CASE statements, GROUP BY and aggregate functions
  • Related to: Data pivoting, data pivoting, data aggregation, SQL transformation
  • Example use case: Converting transaction data (row format) into a monthly sales overview (column format)
Quelle: AI Generated