Difference between revisions of "FOREIGN KEY Column 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== | ||
Column constraint to define a column as a Foreign Key for a parent table | Column constraint to define a column as a Foreign Key for a parent table | ||
− | |||
==Syntax== | ==Syntax== | ||
FOREIGN KEY [COLLATE <cCollateSequence>] | FOREIGN KEY [COLLATE <cCollateSequence>] | ||
− | |||
==See Also== | ==See Also== | ||
[[ALTER TABLE]], [[SQL Constraints|CONSTRAINTS]], [[CREATE TABLE]] | [[ALTER TABLE]], [[SQL Constraints|CONSTRAINTS]], [[CREATE TABLE]] | ||
− | |||
==Description== | ==Description== | ||
Line 17: | Line 14: | ||
The optional COLLATE <cCollateSequence> clause is included for Visual FoxPro language compatibility only. | The optional COLLATE <cCollateSequence> clause is included for Visual FoxPro language compatibility only. | ||
− | |||
==Example== | ==Example== | ||
Line 25: | Line 21: | ||
item_ref char(5) PRIMARY KEY) | item_ref char(5) PRIMARY KEY) | ||
</code> | </code> | ||
− | |||
==Products== | ==Products== | ||
− | + | Lianja, Lianja Server | |
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:SQL]] | [[Category:SQL]] |
Latest revision as of 10:17, 11 December 2012
Purpose
Column constraint to define a column as a Foreign Key for a parent table
Syntax
FOREIGN 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 FOREIGN KEY column constraint is used to define the column as a Foreign Key for a parent table. A tag index is built on the specified column; it is given the same name as the column. More than one column in the table can be defined as a Foreign Key.
The optional COLLATE <cCollateSequence> clause is included for Visual FoxPro language compatibility only.
Example
CREATE TABLE orderitem; (ord_ref char(5) FOREIGN KEY,; item_ref char(5) PRIMARY KEY)
Products
Lianja, Lianja Server