Was this helpful?
Constraint Specifications
When a constraint is added to a table, the table is checked to ensure that its contents do not violate the constraint. If the contents of the table do violate the constraint, the DBMS Server returns an error and does not add the constraint.
The following table summarizes the elements of the constraint_clause:
Type
Keyword
Example
Referential
REFERENCES
ALTER TABLE dept_const
ADD CONSTRAINT chkmgr
FOREIGN KEY(mgr) REFERENCES emp(ename);
Unique
UNIQUE
ALTER TABLE emp_const
ADD UNIQUE (eno, ename);
Primary key
PRIMARY KEY
ALTER TABLE emp_const
ADD CONSTRAINT ekey
PRIMARY KEY(eno);
For more information, see Constraints.
Last modified date: 12/06/2024