GROUPING SETS Option | SQL SELECT Statements | Teradata Vantage - 17.05 - GROUPING SETS Option - 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)
Analyzes data in one of two possible ways:
  • In a single dimension without performing a full ROLLUP.
  • In multiple dimensions without performing a full CUBE.

ANSI Compliance

GROUPING SETS is ANSI SQL:2011 compliant.

SAMPLE Clause and GROUPING SETS

You cannot specify a SAMPLE clause in a query that also specifies the GROUPING SETS option in a GROUP BY clause. The exception is a query where the GROUPING SETS option is specified in a derived table or a view, and the SAMPLE clause is specified in the outer query.

How GROUPING SETS Summarizes Data

GROUPING SETS allows you to group your results set multiple times. Empty parentheses () specify a single grand total group that sums all the groups specified in the query.