Skip to main content

Table definitions

The CREATE TABLE statement conforms to the full SQL standard. Tables are assigned to the current schema unless the schema name is explicitly given as part of the table name. Table names should be unique amongst those mentioned within the same schema and distinct from index-, contraint-x, and view-names.

table_def:
     CREATE TABLE table_name table_content_source
   | CREATE MERGE TABLE table_name table_content_source
   | CREATE REPLICA TABLE table_name table_content_source
   | CREATE REMOTE TABLE table_name table_content_source ON STRING

table_content_source:
   '(' table_element_list ') 
  |  ['(' column_name_list ')' ] AS select_query  { WITH NO DATA | WITH DATA }

The derived (temporary) tables are either filled upon creation or automatically upon use within queries.

table_def:
   | CREATE [LOCAL | GLOBAL] TEMPORARY  TABLE table_name '(' table_content_source ')'
                     [ ON COMMIT [ DELETE ROWS |  PRESERVE ROWS |  DROP ] ]

Temporary local tables are limited to the client session. They are stored automatically under the schema 'tmp'. The qualifiers denote the actions taken during transaction commit over a temporary table. If the ON COMMIT clause is omitted then all tuples are dropped while retaining the structure.