unpivot is the inverse of pivot: it turns columns into rows. This post walks through the syntax, the null-handling options and a set of runnable examples for the China-domestically developed GBase 8a MPP database from GBASE. The source note marks itself as still being refined, so one parameter description is deliberately left short.
Reference
The companion post on pivot , which turns rows into columns in GBase 8a.
Syntax
unpivot [ { include_nulls | exclude_nulls } ] ( COLUMN | ( COLUMN [ , COLUMN ] . . ) FOR COLUMN | ( COLUMN [ , COLUMN ] . . ) IN COLUMN | ( COLUMN [ , COLUMN ] . . . ) [ AS LITERAL | ( LITERAL [ , LITERAL ] . . . ) ] )
Enter fullscreen mode
Exit fullscreen mode
Notes
NULLS
INCLUDE_NULLS : when the column value to be converted is null, do not filter it — the row is still shown.
EXCLUDE_NULLS : when the column value is null, filter it out ( is not null ) and the row is not shown.…