You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/en/sql-reference/10-sql-commands/20-query-syntax/05-query-unpivot.md
+17-15Lines changed: 17 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,8 @@ FROM ...
24
24
Where:
25
25
*`<value_column>`: The column that will store the values extracted from the columns listed in `<column_list>`.
26
26
*`<name_column>`: The column that will store the names of the columns from which the values were extracted.
27
-
*`<column_list>`: The list of columns to be unpivoted, separated by commas.
27
+
*`<column_list>`: The list of columns to be unpivoted, separated by commas. You can optionally provide aliases for the column names using AS or just a string literal.
28
+
28
29
29
30
30
31
## Examples
@@ -57,21 +58,22 @@ INSERT INTO unpivoted_monthly_sales VALUES
57
58
SELECT*
58
59
FROM unpivoted_monthly_sales
59
60
UNPIVOT (amount
60
-
FOR month IN (jan, feb, mar, apr));
61
+
FOR month IN (janas'Jan', febAS'Feb', mar'MARCH', apr));
0 commit comments