Ordinary Grouping Set Expressions - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

The following table provides the definitions for the valid ordinary grouping set expressions you can specify in a GROUP BY clause.

Ordinary Grouping Set Expression                                                         Definition
column_name Set of column names drawn from the list of tables specified in the FROM clause of the SELECT statement that is used in the GROUP BY clause to specify the columns by which data is to be grouped.

The maximum number of columns you can specify is 64.

You cannot include LOB columns in the grouping expression.

You can specify a column_name_alias instead of column_name if the alias does not have the same name as a physical column in the table definition. You must specify column_position, not column_name_alias.

column_position Sequential numeric position of columns within the column_list clause of the SELECT statement that is used in the GROUP BY clause to specify the order by which data is to be grouped.

The value you specify must be a positive constant integer literal with a value between 1 and the number of columns specified in the select list, inclusive. Vantage treats macro and procedure parameters as expressions, not as the specification of a column position.

You cannot include LOB columns in the grouping expression.

This is a Teradata extension to the ANSI SQL:2011 standard.

column_expression List of valid SQL expressions specified for the GROUP BY clause.

You can specify column_name, column_position, and expression either as single entries or as a list.

You can specify a scalar subquery as an ordinary grouping set expression.

You can also specify a scalar UDF as an ordinary grouping set expression.

You cannot include LOB columns in the ordinary grouping set.

Use of column_expression is a Teradata extension to the ANSI SQL:2011 standard.