SQL
UNPIVOT Statement
The `UNPIVOT` statement allows multiple columns to be stacked into fewer columns.
In the basic case, multiple columns are stacked into two columns: a `NAME` column (which contains the name of the source column) and a `VALUE` column (which contains the value from the source column).  
DuckDB implements both the SQL Standard `UNPIVOT` syntax and a simplified `UNPIVOT` syntax.
Both can utilize a [`COLUMNS` expression](#docs:sql:expressions:star::columns) to automatically detect the columns to unpivot.
`PIVOT_LONGER` may also be used in place of the `UNPIVOT` keyword.  
For details on how the `UNPIVOT` statement is implemented, see the [Pivot Internals site](#docs:internals:pivot::unpivot).  
> The [`PIVOT` statement](#docs:sql:statements:pivot) is the inverse of the `UNPIVOT` statement.