Pivoting Syntax Elements - Teradata Vantage

Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
9.02
9.01
2.0
1.3
Published
February 2022
Language
English (United States)
Last Update
2022-02-10
dita:mapPath
rnn1580259159235.ditamap
dita:ditavalPath
ybt1582220416951.ditaval
dita:id
B700-4003
lifecycle
previous
Product Category
Teradata Vantageā„¢
PartitionColumns
Specify the same columns as the PARTITION BY clause (in any order).
NumberOfRows
[Required if you omit PivotColumn.] Use NumberOfRows when no column contains pivot keys, but you can specify a maximum number of rows in any partition. The function pivots the input rows into this number of columns in the output table.

If a partition has fewer than number_of_rows rows, the function adds NULL values; if a partition has more than number_of_rows rows, the function omits the extra rows.

If you use NumberOfRows, you must use the ORDER BY clause to order the input data; otherwise, the contents of the output table columns may vary from run to run.

PivotColumn
[Required if you omit NumberOfRows.] Specify the name of the input column that contains the pivot keys.

If pivot_column contains numeric values, the function casts them to VARCHAR; function performance improves slightly if you specify NumericPivotKey ('true').

PivotKeys
[Required if you specify PivotColumn.] Specify the values in pivot_column to use as pivot keys. The function ignores rows that contain other values in pivot_column.
DefaultPivotValues
[Optional with PivotKeys, disallowed otherwise.] Specify exactly one default value for each pivot_key. The nth default_pivot_value applies to the nth pivot_key. The data type of each default_pivot_value must be compatible with the data type of target_column.
NumericPivotKey
[Optional] Use this syntax element only with the PivotColumn syntax element. If pivot_column is numeric, NumericPivotKey ('true') improves function performance slightly.
Default: 'false'
TargetColumns
[Optional] Specify the names of the target columns (input columns that contain the values to pivot).