CUBE Option | SQL SELECT Statements | Teradata Vantage - CUBE Option - 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
Language
English (United States)
Last Update
2024-04-05
dita:mapPath
pon1628111750298.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
esx1472246586715
lifecycle
latest
Product Category
Teradata Vantage™

Analyzes data by grouping it into multiple dimensions.

ANSI Compliance

CUBE is ANSI SQL:2011 compliant.

Rules and Restrictions for CUBE

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

How CUBE Summarizes Data

Given n dimensions, CUBE generates 2n different kinds of groups. The database reports each group as a single row.

For example, with 2 dimensions, CUBE generates 4 groups as follows:

group number dimension 1 dimension 2
1 X X
2 X  
3   X
4    

With 3 dimensions, CUBE generates 8 groups as follows:

group number dimension 1 dimension 2 dimension 3
1 X X X
2 X X  
3 X   X
4 X    
5   X X
6   X  
7     X
8