Difference between revisions of "PRIMARY KEY Column Constraint"
Helengeorge (Talk | contribs) (→Products) |
Yvonnemilne (Talk | contribs) |
||
Line 21: | Line 21: | ||
==Example== | ==Example== | ||
<code lang="recital"> | <code lang="recital"> | ||
− | + | CREATE TABLE newcust; | |
− | CREATE TABLE newcust (acc_ref char(5) default strzero(seqno(),5) PRIMARY KEY, ; | + | (acc_ref char(5); |
− | acc_name char(20)) | + | default strzero(seqno(),5); |
− | + | PRIMARY KEY,; | |
+ | acc_name char(20)) | ||
</code> | </code> | ||
Latest revision as of 11:35, 22 December 2009
Purpose
Column constraint to define table's Primary Key
Syntax
PRIMARY KEY [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 PRIMARY KEY column constraint is used to define the column as the table's Primary Key. A unique tag index is built on the specified column; it is given the same name as the column. If a table already has a primary key defined, an error will be returned.
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); PRIMARY KEY,; acc_name char(20))
Products
Recital, Recital Server