The REFERENTIAL_CONSTRAINTS view contains information about foreign keys.
| Column | Description |
|---|---|
CONSTRAINT_CATALOG |
The catalog containing the constraint. This value is always def. |
CONSTRAINT_SCHEMA |
The schema (database) containing the constraint. |
CONSTRAINT_NAME |
The name of the constraint. |
UNIQUE_CONSTRAINT_CATALOG |
The catalog containing the unique constraint referenced by this constraint. This value is always def. |
UNIQUE_CONSTRAINT_SCHEMA |
The schema containing the unique constraint referenced by this constraint. |
UNIQUE_CONSTRAINT_NAME |
The name of the unique constraint that is referenced by this constraint. |
MATCH_OPTION |
The value of the constraint’s MATCH attribute. Currently, the only valid value is NONE. |
UPDATE_RULE |
The value of the constraint’s ON UPDATE attribute. Possible values: CASCADE, SET NULL, SET DEFAULT, RESTRICT, or NO ACTION. |
DELETE_RULE |
The value of the constraint’s ON DELETE attribute. Possible values: CASCADE, SET NULL, SET DEFAULT, RESTRICT, or NO ACTION. |
TABLE_NAME |
The name of the table. |
REFERENCED_TABLE_NAME |
The name of the table that is referenced by this constraint. |
For more information, see the MySQL documentation: The INFORMATION_SCHEMA REFERENTIAL_CONSTRAINTS Table.