GROUPING SETS Option Syntax | SQL SELECT Statements | Teradata Vantage - GROUPING SETS Option Syntax - Analytics Database - Teradata Vantage

SQL Data Manipulation Language

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
ft:locale
en-US
ft:lastEdition
2024-12-13
dita:mapPath
pon1628111750298.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
esx1472246586715
lifecycle
latest
Product Category
Teradata Vantageā„¢
GROUPING SETS group_by_spec

Syntax Elements

group_by_spec
{ ordinary_grouping_set |
  empty_grouping_set |
  rollup_list |
  cube_list |
  grouping_sets_specification
}
ordinary_grouping_set
One or more expressions used to group cubed report rows across multiple dimensions.
All ordinary grouping sets must make explicit column references. You cannot specify column positions with GROUPING SETS.
You cannot specify more than 190 columns in the ordinary grouping sets.
You cannot reference columns that have a BLOB or CLOB data type unless they are first CAST to another type or passed to a function whose result is not a LOB. For example, casting a BLOB to a BYTE or VARBYTE type, or casting a CLOB to a CHARACTER or VARCHAR type.
The expression cannot group result rows that have a BLOB, CLOB, ARRAY, or VARRAY type.
empty_grouping_set
A contiguous LEFT PARENTHESIS, RIGHT PARENTHESIS pair with no argument. This syntax is used to provide a grand total.
The term grand total here refers to a summation of all the individual group totals, not a summation of the nonaggregate data.
rollup_list
A standard grouping expression set specified with ROLLUP. If you specify more than one expression, the expression list must be enclosed by parentheses.
The expression cannot group result rows that have a BLOB, CLOB, ARRAY, or VARRAY type.
See ROLLUP Option for more information.
cube_list
a standard grouping expression set specified with CUBE. If you specify more than one expression, the expression list must be enclosed by parentheses.
The expression cannot group result rows that have a BLOB, CLOB, ARRAY, or VARRAY type.
See CUBE Option for more information.
grouping_sets_specification
Any of the following:
  • ordinary_grouping_setenclosed in parenthesis
  • rollup_list
  • cube_list
  • empty_grouping_set
  • grouping_sets_specification
There is no limit to the number of nesting levels for grouping sets specifications other than your system configuration.
You cannot reference columns that have a LOB data type.