group_specification - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
Language
English (United States)
Last Update
2024-04-03
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905
GROUP BY
An introduction to an optional reference to one or more expressions in the select expression list used to group rows in the results set.
ordinary_grouping_set
A column expression by which the rows returned by the request are grouped.
You cannot include BLOB, CLOB, UDT, Period, or Geospatial columns in the grouping expression.
You can group by:
  • column_name

    A set of column names drawn from the list of tables specified in the FROM clause of the SELECT request that is used in the GROUP BY clause to specify the columns by which data is to be grouped.

    See Object Names for the rules for naming database objects.

  • column_position

    The 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 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.

    This must be a positive integer.

    Use of column_position is a Teradata extension to the ANSI SQL-2011 standard.

  • expression

    Any list of valid SQL expressions specified for the GROUP BY clause.

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

    Use of expression is a Teradata extension to the ANSI SQL-2011 standard.

    For details about ordinary grouping sets, see Ordinary Grouping Set Expressions.

empty_grouping_set
A contiguous LEFT PARENTHESIS, RIGHT PARENTHESIS pair with no argument. Typically, this syntax is used to request a grand total.
rollup_list
A ROLLUP expression that reports result rows in a single dimension with one or more levels of detail. See ROLLUP Option for further information.
cube_list
A CUBE expression that reports result rows in multiple dimensions with one or more levels of detail. See CUBE Option for further information.
grouping_sets_specification
A GROUPING SETS expression that reports result rows in one of two ways:
  • As a single dimension, but without a full ROLLUP.
  • As multiple dimensions, but without a full CUBE.
See GROUPING SETS Option for further information.