SQL/MX 2.x Reference Manual (H06.04+)

SQL/MX Statements
HP NonStop SQL/MX Reference Manual540440-003
2-80
Syntax Description of CREATE TABLE
You cannot refer to the CURRENT_DATE, CURRENT_TIME, or
CURRENT_TIMESTAMP function in a CHECK constraint, and you cannot use
subqueries in a CHECK constraint. CHECK constraints cannot contain
non-ISO88591 string literals.
REFERENCES ref-spec
specifies a references column constraint. The maximum combined length of the
columns for a REFERENCES constraint is 255 bytes.
FOREIGN KEY (column-list) REFERENCES ref-spec
is a column or table constraint (respectively) that specifies a referential constraint
for the table, declaring that a column or set of columns (called a foreign key) in
table can contain only values that match those in a column or set of columns in
the table specified in the REFERENCES clause.
The two columns or sets of columns must have the same characteristics (data
type, length, scale, precision), and there must be a UNIQUE or PRIMARY KEY
constraint on the column or set of columns specified in the REFERENCES clause.
Without the FOREIGN KEY clause, the foreign key in table is the column being
defined; with the FOREIGN KEY clause, the foreign key is the column or set of
columns specified in the FOREIGN KEY clause.
ref-spec is:
referenced-table [(column-list)] [referential triggered
action]
referenced-table is the table referenced by the foreign key in a
referential constraint. referenced-table cannot be a view.
referenced-table cannot be the same as table.
column-list specifies the column or set of columns in
referenced-table that corresponds to the foreign key in table. The
columns in the column list associated with REFERENCES must be in the
same order as the columns in the column list associated with FOREIGN
KEY. If column-list is omitted, the referenced table's PRIMARY KEY
columns are the referenced columns.
update rule specifies what referential action is taken when
column-list in referenced-table is updated. If no ON UPDATE
clause is specified, a default of ON UPDATE NO ACTION is assumed.
delete rule specifies what referential action is taken when a
row in referenced-table is deleted. If no ON DELETE clause is
specified, a default of ON DELETE NO ACTION is assumed.