9. Extended Statements : Create Table (extended) : Column Specifications
 
Share this page                  
Column Specifications
The column_specification in a CREATE TABLE statement describes the characteristics of the column.
The column_specification has the following syntax:
column_name datatype
[[WITH] DEFAULT default_spec | WITH DEFAULT | NOT DEFAULT]
[WITH NULL | NOT NULL|
[[CONSTRAINT constraint_name] column_constraint
{[CONSTRAINT constraint_name] column_constraint}]
where column_constraint is one or more of the following:
UNIQUE [WITH constraint_with_ clause]
PRIMARY KEY [WITH constraint_with_clause]
REFERENCES[schema.]table_name[(column_name)]
    [WITH constraint_with_clause]
column_name
Assigns a valid name to the column.
datatype
Assigns a valid data type to the column. If CREATE TABLE...AS SELECT is specified, the new table takes its column names and formats from the results of the SELECT clause of the subselect specified in the AS clause (unless different column names are specified).
[[WITH] DEFAULT default_spec | WITH DEFAULT | NOT DEFAULT]
Specifies whether the column is mandatory, as described in Default Clause (see page Default Clause).
WITH NULL | NOT NULL
Specifies whether the column accept nulls, as described in Null Clause.
[CONSTRAINT constraint_name] column_constraint
Specifies checks to be performed on the contents of the column to ensure appropriate data values, as described in Constraints (see page Constraints).