5.2.10 Specifying a foreign key (FOREIGN KEY)
A column (or a combination of columns) that references the primary key of another base table is called a foreign key. Using primary keys and foreign keys, you can define relationships among the tables in a database.
To define a foreign key, specify a referential constraint definition in the CREATE TABLE statement.
- Important
-
Even when you specify a referential constraint definition in the CREATE TABLE statement, the referential constraint cannot be checked based on the foreign key. Therefore, a foreign key cannot be used to maintain data consistency between tables.
- Note
-
-
Define a foreign key when you want to use a business intelligence tool or the like to output an entity-relationship diagram or define a relationship among tables in a database.
-
For details about primary keys, see 5.2.9 Specifying a primary key (uniqueness constraint definition) (PRIMARY KEY) [Single-chunk table].
-