Page tree
Skip to end of metadata
Go to start of metadata

Generates cubes from a query.

Syntax

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

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 CUBES

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

  • No labels