Previous Topic

Next Topic

Column Specification—Describe Column Characteristics

The column_specification in a CREATE TABLE statement describes the characteristics of the column.

This statement has the following format:

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}]

[COLLATE collation_name]

Previous Topic

Next Topic

Default Clause

The WITH|NOT DEFAULT clause in the column specification specifies whether a column requires an entry.

This clause has the following format:

[WITH] DEFAULT default_spec | WITH DEFAULT | NOT DEFAULT

The following is an example of using the DEFAULT clause:

CREATE TABLE DEPT(dname    CHAR(10),
    location      CHAR(10)   DEFAULT 'NY',
    creation      DATE       DEFAULT '01/01/03',
    budget        MONEY      DEFAULT 10000);

Restrictions on the Default Value for a Column

The following considerations and restrictions apply when specifying a default value for a column:

Previous Topic

Next Topic

Null Clause

To specify whether a column accepts null values, specify the WITH|NOT NULL clause in the column specification.

This clause has the following format:

WITH NULL | NOT NULL

With|Not Null and With|Not Default Combinations

The WITH|NOT NULL clause works in combination with the WITH|NOT DEFAULT clause, as follows:


© 2007 Ingres Corporation. All rights reserved.