Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Generates cubes from a query.

Syntax

Code Block
languagesql
linenumberstrue
GENERATE CUBE {cubes-tag} 
[WITH WHERE where-expression] FROM select-statement

Description

Cube tag and query (select statement) must be provided.

Cubes with a Filter
To create a cube with a filter (a cube with where statement), use the WITH WHERE clause. Cubes with WHERE are generated using filtered data, based on the given where expression, and can be applied only to queries that include identical where expression in their where clause.

Example

Code Block
languagesql
linenumberstrue
GENERATE CUBES mycube 
FROM 
SELECT PRODUCT, SUM(PRICE)
FROM T_PRODUCT
WHERE COUNTRY='US'
GROUP BY PRODUCT;


cube tag | status                | rows | candidate query
---------------------------------------------------------------------
cube1    | finished successfully |   13 | SELECT sales_demo.store_country,
                                        | sales_demo.store_name,
                                        | sum(sales_demo.net_profit)  
                                        | FROM 
                                        | sales_demo
                                        | GROUP BY 
                                        | sales_demo.store_country,
                                        | sales_demo.store_name
---------------------------------------------------------------------

See Also

DROP CUBESSHOW CUBES {WITH WHERE <where-clause>} FROM <select-statement>