17.05 - Ordinary Grouping Set Expressions - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Manipulation Language

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
Release Date
January 2021
Content Type
Programming Reference
Publication ID
B035-1146-175K
Language
English (United States)

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 as long as it does not have the same name as a physical column in the table definition. In this case, 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. Note thatVantage 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.