SQL/MP Reference Manual

HP NonStop SQL/MP Reference Manual523352-013
C-141
Examples—CREATE CONSTRAINT
Examples—CREATE CONSTRAINT
This example 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;
This example 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;
This example 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);