Adding New Table Constraints

From InterBase
Jump to: navigation, search

Go Up to Using ALTER TABLE


You can use ALTER TABLE to add a new table-level constraint. The syntax is:

ALTER TABLE name ADD [CONSTRAINT constraint] <tconstraint_opt>;

where <tconstraint_opt> is a PRIMARY KEY, FOREIGN KEY, UNIQUE, or CHECK constraint. For example:

ALTER TABLE EMPLOYEE
 ADD CONSTRAINT DEPT_NO UNIQUE(PHONE_EXT);