Menu

Using unpivot to Turn Columns into Rows in GBase 8a
📰

Using unpivot to Turn Columns into Rows in GBase 8a

DEV Community: sql·Michael·6 days ago
#6p17sm26
#devtosql#devto#dev#total#chinese
Long article (977 words) — no AI summary yet.
Reading 0:00
15s threshold

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.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.