NonStop SQL/MP Reference Manual

Table Of Contents
NonStop SQL/MP Reference Manual142115
C-133
Examples—CREATE CONSTRAINT
Program invalidation
CREATE CONSTRAINT invalidates SQL programs that use the underlying table.
Examples—CREATE CONSTRAINT
The following statement creates a constraint to ensure that only values greater than
$10,000 are entered in the SALARY column:
CREATE CONSTRAINT ASAL ON \SYS1.$VOL1.PERSNL.EMPLOYEE
CHECK SALARY > 10000;
The following statement creates a constraint that enforces a relationship between
two items in a row. In this case, the constraint ensures that a delivery date for an
order is not earlier than the date the order was taken:
CREATE CONSTRAINT DATE_CONSTRNT ON SALES.ORDERS
CHECK DELIV_DATE >= ORDER_DATE;
The following statement creates a constraint to ensure that data in a character
column is stored in uppercase letters:
CREATE CONSTRAINT UPSHIFT_DESCRIPTION ON PARTS
CHECK PARTDESC = UPSHIFT (PARTDESC);
CREATE INDEX Statement
CREATE INDEX is a DDL statement that creates an index based on one or more
columns of a table.
Note that CREATE INDEX effectively invalidates online dumps of the table underlying
the new index. To ensure TMF file-recovery protection, make new online dumps of all
partitions of the table and its indexes. For more information about online dumps, see the
NonStop SQL/MP Installation and Management Guide.
CREATE [ UNIQUE ] INDEX index ON table
( col [ ASC[ENDING] ] [ collate-spec ]
[ DESC[ENDING] ]
[ , col [ ASC[ENDING] ] [ collate-spec ] ] ... )
[ DESC[ENDING] ]
[| CATALOG catalog |]
[| PHYSVOL volume-name |]
[| { INVALIDATE | NO INVALIDATE } |]
[| KEYTAG key-specifier |]
[| PARALLEL EXECUTION { ON [ CONFIG file ] | OFF } |]
[| PARTITION ( partition [ , partition ] ... ) |]
[| WITH SHARED ACCESS [ wsa-spec ] |]
[| attribute-spec |]