Unique Table Constraints
A unique table constraint ensures that a particular column, or set of columns, has a unique value or set of values, thereby uniquely identifying each record in a database table.
The unique and primary key constraints (
Primary Key Constraints) both provide a guarantee of uniqueness for a column or set of columns, and a primary key constraint automatically has a unique constraint defined on it. A table can have only one primary key constraint, but may have multiple unique constraints.
You can name a unique constraint or let the server assign a name.
Class
RWDBUniqueConstraint encapsulates a unique constraint, and
RWDBUniqueConstraintList holds any number of
RWDBUniqueConstraint instances. An
RWDBSchema object always contains a single
RWDBUniqueConstraintList containing zero or more unique constraints relevant to that schema.
A unique constraint can be comprised of a single column or multiple columns. A unique constraint on multiple columns enforces a unique combination, even if values in individual columns are repeated. For example, consider these two columns, both part of a single unique constraint:
Each of these rows is allowed, because each row’s values form a unique pair between the two columns — but another row with values of 1,1 would be disallowed, as that set is already present.