SQL/MP Reference Manual

HP NonStop SQL/MP Reference Manual523352-013
C-154
CREATE TABLE Statement
CREATE TABLE Statement
CREATE TABLE is a DDL statement that creates a table.
CREATE TABLE requires you to specify a table name and a description of each
column in the table, but allows you to specify many other attributes of the table as well.
A typical table definition also includes a description of the primary key or clustering key
for the table (which affects data retrieval and storage for the table) and the name of the
catalog to receive the description of the table.
CREATE TABLE table { like-spec }
{ definition-spec }
[| CATALOG catalog |]
[| PHYSVOL volume-name |]
[| CLUSTERING KEY key-column-list |]
[| { ORGANIZATION } { K[EY SEQUENCED] } |]
[| { ORGANISATION } { E[NTRY SEQUENCED] } |]
[| { R[ELATIVE] } |]
[| PARTITION ( partition [ , partition ] ... ) |]
[| PARTITION ARRAY { | STANDARD | } |]
[| { | EXTENDED | } |]
[| { | FORMAT2ENABLED | } |]
[| SECURE "rwep" |]
[| SIMILARITY CHECK { ENABLE | DISABLE } |]
[| attribute-spec |]
like-spec is:
[| WITH COMMENTS |]
LIKE source-table [| WITH CONSTRAINTS |]
[| WITH HEADINGS |]
[| WITH HELP TEXT |]
definition-spec is:
{ ( col-def [ , col-def ] ... }
{ [ , [ PRIMARY ] KEY key-column-list ] }
{ [ , col-def ] ... ) }
{ ( [ PRIMARY ] KEY key-column-list , col-def }
{ [ , col-def ] ... ) }
col-def is:
column-name data-type
[ DEFAULT default | NO DEFAULT ] [ NOT NULL ]
[ HEADING string | NO HEADING ]
key-column-list for CLUSTERING KEY or PRIMARY KEY is:
{ col-name [ ASC[ENDING] | DESC[ENDING] ] }
{ ( col-name [ ASC[ENDING] | DESC[ENDING] }
{ [, col-name [ASC[ENDING] | DESC[ENDING] ] ... ) }