SQL/MX 2.x Reference Manual (H06.10+, J06.03+)
SQL/MX Statements
HP NonStop SQL/MX Reference Manual—544517-008
2-19
Syntax Description of ALTER TABLE
When a PRIMARY KEY constraint is created on a table, all the index columns must
have a NOT NULL clause in the CREATE TABLE statement for the table.
The value of the PRIMARY_KEY_CONSTRAINT_DROPPABLE_OPTION attribute
in the DEFAULTS Table has no affect on a PRIMARY KEY constraint added by
using the ALTER TABLE statement because in this case the PRIMARY KEY is
always droppable.
CHECK (condition)
is a constraint that specifies a condition that must be satisfied for each row in
the table.
NonStop SQL/MX checks the condition whenever an insert or update operation
occurs that might affect its value. The operation is allowed if the predicate in the
search condition evaluates to TRUE or null, but is prohibited if the predicate
evaluates to FALSE. When a check constraint is added, existing data is checked
for violations.
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.
See Search Condition on page 6-103.
REFERENCES ref-spec
or
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
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.
The foreign key is the column or set of columns specified in the FOREIGN KEY
clause, immediately following the FOREIGN KEY keywords.
ref-spec is:
referenced-table [(column-list)]
referenced-table is the table referenced by the foreign key in a referential
constraint. referenced-table cannot be a view, and 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










