O'Reilly logo

Oracle Database Administration: The Essential Refe by Brian Laskey, David C. Kreines

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

table_constraint_clause

The following is the syntax for the table_constraint_clause in the CREATE TABLE statement:

{
[NULL | NOT NULL] |
[UNIQUE | PRIMARY KEY] |
[FOREIGN KEY (column [, column ...] )]
[REFERENCES [schema.]table_name[(column)] [ON DELETE CASCADE] ]
[CHECK (condition) ]
}
[USING INDEX 
    [PCTFREE integer]
    [PCTUSED integer]
    [INITRANS integer]
    [MAXTRANS integer] 
    [TABLESPACE tablespace_name]
    [STORAGE (
        [INITIAL integer [K | M]]			
        [NEXT integer [K | M]]
        [MINEXTENTS integer [K | M]] 
        [MAXEXTENTS {integer | UNLIMITED}]
        [PCTINCREASE integer]
        [FREELISTS integer]
        [FREELIST GROUPS integer]
        )
    [NOSORT]
    [LOGGING | NOLOGGING]
]
[EXCEPTIONS INTO [schema.]table_name]
[{ENABLE [VALIDATE  | NOVALIDATE] | DISABLE} ]
[[NOT] DEFERRABLE [INITIALLY {IMMEDIATE | DEFERRED}] ]
[[INITIALLY {IMMEDIATE | DEFERRED}] [[NOT] DEFERRABLE] ]
NULL

Specifies that the values in the column list may contain NULL.

NOT NULL

Specifies that the values in the column may not contain NULL.

UNIQUE

Specifies that the column list must be unique.

PRIMARY KEY

Specifies that the column list will be a primary key. A primary key can be referenced from another table with a foreign key. A primary key must also be UNIQUE and NOT NULL.

FOREIGN KEY

Requires that all values in the column list must be either NULL or found in the referenced table’s defined primary key or the specified column list.

REFERENCES

Specifies the table that is referenced.

ON DELETE CASCADE

Specifies that any deletes to the referenced table are propagated down to this table ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required