Syntax
The CREATE TABLE statement has the following format:
[EXEC SQL] CREATE TABLE [schema.] table_name
(column_specification {, column_specification }
[, [CONSTRAINT constraint_name] table_constraint
{, [CONSTRAINT constraint_name] table_constraint}])
[WITH with_clause]
The CREATE TABLE...AS SELECT statement (which creates a table and loads rows from another table) has the following format:
[EXEC SQL] CREATE TABLE table_name
(column_name {, column_name}) AS
[WITH common_table_expression] subselect
{UNION [ALL]
subselect}
[WITH with_clause]
table_name
Defines the name of the new table, which must be a valid object name.
column_specification
table_constraint
with_clause
Consists of a comma-separated list of one or more of the following options, described in detail in
With_Clause for Create Table (see page
With_Clause for Create Table):
• LOCATION = (location_name {, location_name})
• [NO]JOURNALING
• [NO]DUPLICATES
• PAGE_SIZE = n
• SECURITY_AUDIT = (audit_opt {, audit_opt})
• SECURITY_AUDIT_KEY = (column)
• NOPARTITION | PARTITION = ( partitioning-scheme )
• [NO]AUTOSTRUCT
• COMPRESSION[= ([[NO]KEY] [,[NO]DATA])] | NOCOMPRESSION
• ALLOCATION = n
• EXTEND = n
• PRIORITY = n
• ENCRYPTION=AES128|AES192|AES256, [AESKEY=hex-aes-key,] PASSPHRASE='encryption-passphrase'
• STRUCTURE = HASH | HEAP | ISAM | BTREE
• KEY = (column_name {, column_name})
• FILLFACTOR = n
• MINPAGES = n
• MAXPAGES = n
• LEAFFILL = n
• NONLEAFFILL = n
AS [WITH common_table_expression] subselect
(Valid in CREATE TABLE AS SELECT only.)
Note: Subselect cannot be used when creating a table in one or more raw locations--that is, CREATE TABLE raw_table AS SELECT... WITH LOCATION = (raw_loc).