Menu

Turning Rows into Columns with pivot in GBase 8a
📰

Turning Rows into Columns with pivot in GBase 8a

DEV Community: sql·Michael·3 days ago
#HEhSkOTc
#devtosql#devto#dev#math#chinese
Long article (1463 words) — no AI summary yet.
Reading 0:00
15s threshold

GBase 8a provides pivot for turning rows into columns, also called a data pivot. This post walks through the syntax and a progressive set of examples for the China-domestically developed GBase 8a MPP database from GBASE. Student names and the subject labels in the sample tables are translated into English below; all column names, numeric values and row orders stay exactly as in the original output.

Syntax

pivot ( < aggregate_function > ( < column_to_aggregate > ) [ as alias ] [ , < aggregate_function > ( < column_to_aggregate > ) [ as alias ] . . . ] for < column1 [ , column2 . . . ] > in ( constant1 [ as alias1 ] [ , constant2 [ as alias2 ] . . . ] ) )

Enter fullscreen mode

Exit fullscreen mode

Notes

The aggregate part supplies the values of the new columns, and several aggregates are allowed.

for names the column to rotate. Eligible column values are listed in in . With a single column the parentheses can be omitted ( for column_name in ...…

Continue reading — create a free account

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