FOREIGN KEY Constraints - Analytics Database - Teradata Vantage

SQL Data Definition Language Detailed Topics

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-07-11
dita:mapPath
vuk1628111288877.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
B035-1184
lifecycle
latest
Product Category
Teradata Vantage™

If you specify a foreign key as a table attribute, the FOREIGN KEY column_name list must specify columns defined in the table definition for the target table, and the same column name cannot be specified in the foreign key definition more than once.

You can define a simple foreign key at column level, but you must define composite, or multicolumn, foreign keys at table level. Note that the syntax for simple and composite foreign keys is different.

You can define multiple foreign key constraints for a table.

Columns defined with a data type from the following list cannot be a component of a FOREIGN KEY constraint.
  • BLOB
  • CLOB
  • ARRAY
  • VARRAY
  • UDT
  • Period
  • Geospatial

The specified column_name list must be identical to an alternate key in the referenced table that is defined as the PRIMARY KEY column set for that table, as a set of columns defined with the UNIQUE attribute, or as a USI. This is not mandatory for Referential Constraints. See Rules for Using Referential Constraints for details. The table-name variable refers to the referenced table, which must be a user base data table, not a view.