Creates a new table in the database.
Syntax
CREATE TABLE table-name ( { column-definition }, | table-constraint }, ... )
Parameters
column-definition:
column-name data-type [
NOT NULL
] [DEFAULT
default-value ] [ generated-column-spec ]
column-constraint:
PRIMARY KEY
|UNIQUE
|REFERENCES
table-name [( column-name )] [ actions ]
default-value:
string
| number
|CURRENT DATE
|CURRENT TIME
|CURRENT TIMESTAMP
|NULL
generated-column-spec:
GENERATED ALWAYS AS IDENTITY ( START WITH
n, INCREMENT BY
m)
table-constraint:
CONSTRAINT
nameCHECK (
constraint)
Description
The
CREATE TABLE
statement creates a new table.
Examples