Difference between revisions of "UNIQUE Table Constraint"
Yvonne.milne (Talk | contribs) m (1 revision: SQL) |
Helen.george (Talk | contribs) |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
==Purpose== | ==Purpose== | ||
Table constraint to define a candidate index | Table constraint to define a candidate index | ||
− | |||
==Syntax== | ==Syntax== | ||
Line 7: | Line 6: | ||
UNIQUE [<cTagName>] (column1[column2,…]) | UNIQUE [<cTagName>] (column1[column2,…]) | ||
− | |||
==See Also== | ==See Also== | ||
[[ALTER TABLE]], [[SQL Constraints|CONSTRAINTS]], [[CREATE TABLE]] | [[ALTER TABLE]], [[SQL Constraints|CONSTRAINTS]], [[CREATE TABLE]] | ||
− | |||
==Description== | ==Description== | ||
Line 24: | Line 21: | ||
UNIQUE [<cTagName>] (column1[column2,…]) | UNIQUE [<cTagName>] (column1[column2,…]) | ||
The UNIQUE table constraint is used to define a unique index key. The index is built on the column or columns specified and given the name as defined in <cTagName>. | The UNIQUE table constraint is used to define a unique index key. The index is built on the column or columns specified and given the name as defined in <cTagName>. | ||
− | |||
==Example== | ==Example== | ||
Line 38: | Line 34: | ||
UNIQUE FullName (LastName, FirstName, ContRef)) | UNIQUE FullName (LastName, FirstName, ContRef)) | ||
</code> | </code> | ||
− | |||
==Products== | ==Products== | ||
− | + | Lianja, Lianja Server | |
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:SQL]] | [[Category:SQL]] |
Latest revision as of 11:24, 11 December 2012
Purpose
Table constraint to define a candidate index
Syntax
UNIQUE <expr> TAG <cTagName> [COLLATE <cCollateSequence>]
UNIQUE [<cTagName>] (column1[column2,…])
See Also
ALTER TABLE, CONSTRAINTS, CREATE TABLE
Description
A constraint is used to define rules that help to provide data integrity. TABLE constraints apply to table-based operations. You must have ALTER privilege on the table. The table will be locked for EXCLUSIVE use during the operation.
UNIQUE <expr> TAG <cTagName> The UNIQUE table constraint is used to define <expr> as a candidate index for the table. The <expr> can contain any valid index key. A unique tag index is built on the specified <expr>; it is given the name as defined in <cTagName>. A table may have more than one candidate index.
COLLATE <cCollateSequence> The optional COLLATE <cCollateSequence> clause is included for Visual FoxPro language compatibility only.
UNIQUE [<cTagName>] (column1[column2,…]) The UNIQUE table constraint is used to define a unique index key. The index is built on the column or columns specified and given the name as defined in <cTagName>.
Example
CREATE TABLE newcust; (acc_ref char(5) default strzero(seqno(),5),; acc_name char(20)) ALTER TABLE newcust; ADD UNIQUE acc_ref+acc_name TAG RefName CREATE TABLE contact; (ContRef char(5), LastName char(25), FirstName char(25),; UNIQUE FullName (LastName, FirstName, ContRef))
Products
Lianja, Lianja Server