CHECKUNIQUE Column Constraint

From Lianjapedia
Revision as of 13:10, 18 March 2020 by Yvonne.milne (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Purpose

Column constraint to check whether the value of a column is unique

Syntax

CHECKUNIQUE

See Also

ALTER TABLE, CONSTRAINTS, CREATE TABLE

Description

A constraint is used to define rules that help to provide data integrity. Column constraints are specific to the column name specified. You must have ALTER privilege on the table. The table will be locked for EXCLUSIVE use during the operation.

The CHECKUNIQUE column constraint is used to check for column uniqueness when adding a new record or updating an existing record in the GUI. If the column value already exists, an error message is displayed when trying to save the record: Cannot save record as field '<tablename>.<column>' is not unique.

Example

ALTER TABLE customers;
  MODIFY CONSTRAINT customerid SET CHECKUNIQUE