Skip to main content
Skip table of contents

Create Table

You are looking at an older version of the documentation. The latest version is found here.

CREATE TABLE

The CREATE TABLE command creates a new table in tthe specified schema.. ThThe syyntaxtax ieollowing:wig:

CODE
CREATE TABLE <dwh_schema_name>.<table_name> <table_definition>

PRIMARY KEY mmay by be specified bied by providing viaproviding via primary key clausclause:

CODE
CREATE TABLE dwh.table1 (col1 integer, col2 string, PRIMARY KEY (col1)) ;;

Example:

CODE
CREATE TABLE dwh.table1 (col1 integer);

this command creates a table called table1 in the analytical storage schema ( )dwh( having oneaving one column col1 wiwith anh an integer type.

CODE
$body

t

To correctlyly executee this command the following requirements are needed:

  1. the schema name must match the name of the analytical storage schema
  2. the ttable to create must not already exist iny exist in the analyanalyticical storage schema

If model property importer.useFullSchemaName=true is set, then the behaviour wilehaviour will b be:

QueryQueryschema in DBschemain DBStablle name name in DBStaDBTtable name in DVTtable name in DVTNoteTNote
create table test_ table test_dwh.public.p1wh.public.p1 (...);;(...);;publicpblicp1p1public.p1public.p1

create table test_dwh.p2_dwh.p2 (...) ;;(...) ;;create table tepublicpublicp2p2public.p2public.p2

createe ttabble test_dwh.dwh.d1 (...) ;;creae test_dwh.dwh.d1 (...) ;;dwhdwhd1d1dwh.d1dwh.d1

create table test_te table test_dwh.dwh2.d2 (...) ;;cwh.dwh2.d2 (...) ;;
The query fails because the schema "dwh2" does not fails because the schema "dwh2" does not existThe quer
  • the ;
  • ;

If model property importer.useFullSchemaName=false is set, then the behavior will be:

  • the;
  • ;

If model property mporter.useFullSchemaName=false is set, thebehavior will be:

QueryQuerySschchema in DBSma in DBTtable name in DBTtable name in DBTtable name in DVTtable name in DV
create table test_dwh.public.p1 (...);;reate table test_dwh.public.p1 (...);;publiccpublpublic.p1public.p1public.p1publc.p1
create table test_ate table test_dwh.p2wh.p2 (...) ;;cr(...) ;;publicpublicp2p2p2p2
create table test_dwh.dwh.d1 (...) ;;create table tet_dwh.dwh.d1 (...) ;;publicpublidwh.d1dw.d1dwh.d1dwh.d1
create table test_dwh.dwh2.d2 (...) ;;crate table test_dwh.dwh2.d2 (...) ;;publicpublic
dwh2.d2dwh2.d2dwh2.d2dwh2.d2

(info) Same ste statements regarding model property are applied to "Select Into"tements regarding model property are applied to "Select Into".

(info) Sa

SELECT INTO

The SELECT INTO command,, givgivenn a source table or a join of source tables, creates a new table in the specified schema and copyy data from the source tables. The syntax is the following:

CODE
SELECT <projection_symbols> INTO <dwh_schema_name>.<table_name> FROM <from_clause>

Example 1:

CODE
SELECT * INTO dwh.table1 FROM source.table2;

The s is the following:

CODE
$body


CODE
$body

this command creates a new table called ttable1 in the analytical storage  ingng the same column definition as havavsource.table2 (the ""staar" " symbolymbol is used in the projection list).

Example 2:

CODE
SELECT t1.a, t2.b INTO dwh.table1 FROM source.table2 t1 JOIN source.table2 t2 ON t1.c = t2.c;


CODE
$body

this command creates a new table called table1 in the analytical storage  ingng two columns )hava and typeb with the same type as in the corresponding corresponding source tables.

TTfollowing requirements are needed:o correctlyly executee this command the following requirements the following requirements are needed:

  1. the following criteria must be met:the schema name must match the name of the analytical storage schema or a schema with a properly set importer.defaultSchema-property
  2. theble to create must ot alreal storage schemathe table provided in the INTO clause must not already exist in the specified schema
  3. the source tables must exist in the correIf model property importer.useFullSchemaName=true is set, then the :sponding stouravce schemas

Tare needed:

  1. -
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.