Use the multiple-column constraint format to associate one or more columns with a constraint. This alternative to the single-column constraint format allows you to associate multiple columns with a constraint.
Multiple-Column Constraint Format: .-,------. V | |--+-+-+-UNIQUE----------+-+--(----column-+--)-+----------------| | | | (1) | | | | | '--------DISTINCT-' | | | '-PRIMARY KEY---------' | | (2) | '-| CHECK Clause |--------------------------'
Element | Description | Restrictions | Syntax |
---|---|---|---|
column | Name of column or columns on which the constraint is placed | Must be unique in a table, but the same name can be in different tables of the same database | Identifier, p. Identifier |
This is a subset of the syntax of Multiple-Column Constraint Format that the CREATE TABLE statement supports.
This alternative to the single-column constraint segment of CREATE Temporary TABLE can associate multiple columns with a constraint. Constraints that you define on temporary tables are always enabled.
The following table indicates where you can find detailed discussions of specific constraints.
Constraint | For more information, see | For an example, see |
---|---|---|
CHECK | CHECK Clause | Defining Check Constraints Across Columns |
DISTINCT | Using the UNIQUE or DISTINCT Constraints | Examples of the Multiple-Column Constraint Format |
PRIMARY KEY | Using the PRIMARY KEY Constraint | Defining Composite Primary and Foreign Keys |
UNIQUE | Using the UNIQUE or DISTINCT Constraints | Examples of the Multiple-Column Constraint Format |
See also the section Differences Between a Unique Constraint and a Unique Index.
Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]