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

SQL/MX Statements
HP NonStop SQL/MX Reference Manual540440-003
2-14
Syntax Description of ALTER TABLE
the PRIMARY KEY constraint for the table. Columns you define as unique
must be specified as NOT NULL.
A UNIQUE constraint is enforced with a unique index. If there is already a
user-defined unique index on column-list, NonStop SQL/MX uses this
index; if not, the system creates a unique index.
The maximum combined length of the columns for a UNIQUE constraint is 255
bytes.
PRIMARY KEY [ASC[ENDING] | DESC[ENDING]] [[NOT] DROPPABLE]
or
PRIMARY KEY key-column-list
is a column or table constraint (respectively) that specifies a column or set of
columns as the primary key for the table. key-column-list cannot include
more than one occurrence of the same column. In addition, the set of columns
you specify on a PRIMARY KEY constraint cannot match the set of columns on
any UNIQUE constraint for the table.
ASCENDING and DESCENDING specify the direction for entries in each
column within the key. The default is ASCENDING.
The PRIMARY KEY value in each row of the table must be unique within the
table. Columns within a PRIMARY KEY cannot contain nulls. A PRIMARY KEY
defined for a set of columns implies that the column values are unique and not
null.
When a PRIMARY KEY table constraint is added by using the ALTER TABLE
statement, it is always droppable. For a PRIMARY KEY column constraint, you
cannot specify NOT DROPPABLE; if you do, NonStop SQL/MX returns an
error.
A PRIMARY KEY constraint is enforced with a unique index. If there is already
a unique index on key-column-list, NonStop SQL/MX uses this index; if
not, the system creates a unique index. Because the PRIMARY KEY constraint
uses a supporting unique index, the clustering key is not part of the constraint
definition and therefore the maximum combined length of the columns for the
PRIMARY KEY is 255 bytes.
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 (search-condition)
is a constraint that specifies a condition that must be satisfied for each row
in the table.