ROLLUP Grouping Set Option - Teradata Database

SQL Data Manipulation Language

Product
Teradata Database
Release Number
16.10
Published
June 2017
Language
English (United States)
Last Update
2018-04-25
dita:mapPath
psg1480972718197.ditamap
dita:ditavalPath
changebar_rev_16_10_exclude_audience_ie.ditaval
dita:id
B035-1146
lifecycle
previous
Product Category
Teradata® Database

Purpose

Analyzes a set of data across a single dimension with more than one level of detail.

Syntax



Syntax Elements

ordinary_grouping_set
One or more expressions used to group rolled up report rows across a single dimension.
The expression cannot group result rows that have a BLOB, CLOB, ARRAY, or VARRAY type.
All ordinary grouping sets must make explicit column references. You cannot specify column positions with ROLLUP.
Rolling up over a single column is equivalent to a simple GROUP BY on that same column.
You cannot specify more than 190 columns in the ordinary grouping sets.
You cannot reference columns that have a LOB data type unless they are first CAST to another data type or passed to a function whose result is not a LOB. For example, casting a BLOB to BYTE or VARBYTE or casting a CLOB to CHARACTER or VARCHAR.

ANSI Compliance

ROLLUP is ANSI SQL:2011 compliant.

SAMPLE Clause and ROLLUP

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

How ROLLUP Summarizes Data

Given n column references, ROLLUP groups data at n levels of detail in one dimension. For example, in Example: Basic ROLLUP, the GROUP BY clause rolls up over three columns and reports three levels of control breaks.