Difference between revisions of "UNIQUE Column Constraint"
Yvonnemilne (Talk | contribs) |
Yvonnemilne (Talk | contribs) |
||
(2 intermediate revisions by one user not shown) | |||
Line 1: | Line 1: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==Purpose== | ==Purpose== | ||
Column constraint to define a candidate index for a table | Column constraint to define a candidate index for a table | ||
Line 28: | Line 21: | ||
==Example== | ==Example== | ||
<code lang="recital"> | <code lang="recital"> | ||
− | + | CREATE TABLE newcust; | |
− | CREATE TABLE newcust (acc_ref char(5) default strzero(seqno(),5) UNIQUE, ; | + | (acc_ref char(5) default strzero(seqno(),5) UNIQUE,; |
− | acc_name char(20) UNIQUE) | + | acc_name char(20) UNIQUE) |
− | + | ||
</code> | </code> | ||
==Products== | ==Products== | ||
− | Recital | + | Recital, Recital Server |
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:SQL]] | [[Category:SQL]] |
Latest revision as of 11:41, 22 December 2009
Purpose
Column constraint to define a candidate index for a table
Syntax
UNIQUE [COLLATE <cCollateSequence>]
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 UNIQUE column constraint is used to define the column as a candidate index for the table. A unique tag index is built on the specified column; it is given the same name as the column. More than one column can be defined as a candidate index for the table.
The optional COLLATE <cCollateSequence> clause is included for Visual FoxPro language compatibility only.
Example
CREATE TABLE newcust; (acc_ref char(5) default strzero(seqno(),5) UNIQUE,; acc_name char(20) UNIQUE)
Products
Recital, Recital Server