Link Search Menu Expand Document

CREATE FACT or DIMENSION TABLEā€¦AS SELECT

Creates a table and loads data into it based on the SELECT query. The table column names and types are automatically inferred based on the output columns of the SELECT. When specifying explicit column names those override the column names inferred from the SELECT.

Syntax

Fact table:

CREATE FACT TABLE <table_name>
[(<column_name>[, ...n] )]
PRIMARY INDEX <column_name>[, <column_name>[, ...n]]
[PARTITION BY <column_name>[, <column_name>[, ...n]]]
AS <select_query>

Dimension table:

CREATE DIMENSION TABLE <table_name>
[(<column_name>[, ...n] )]
[PRIMARY INDEX <column_name>[, <column_name>[, ...n]]]
AS <select_query>
Parameter Description
<table_name> An identifier that specifies the name of the external table. This name should be unique within the database.
<column_name> An identifier that specifies the name of the column. This name should be unique within the table.
<select_query> Any valid select query