REFERENCES Clause

Use the REFERENCES clause to establish a referential relationship:
  • Within a table (that is, between two columns of the same table)
  • Between two tables (in other words, create a foreign key)

This syntax fragment is part of the Single-Column Constraint Format and the Multiple-Column Constraint Format.

(1)
REFERENCES Clause

1  REFERENCES table?  ( + , column )? 1 ON DELETE CASCADE
Notes:
  • 1 HCL OneDB™ extension
Element Description Restrictions Syntax
column A referenced column See Restrictions on Referential Constraints. Identifier
table The referenced table Must reside in the same database as the referencing table Identifier

The referencing column (the column being defined) is the column or set of columns that refers to the referenced column or set of columns. The referencing column can contain NULL and duplicate values, but values in the referenced column (or set of columns) must be unique.

The relationship between referenced and referencing columns is called a parent-child relationship, where the parent is the referenced column (primary key) and the child is the referencing column (foreign key). The referential constraint establishes this parent-child relationship.

When you create a referential constraint, the database server automatically creates an internal index on the constrained column or columns.