The Information Schema REFERENTIAL_CONSTRAINTS table contains information about foreign keys. The single columns are listed in the KEY_COLUMN_USAGE table.

It has the following columns:

ColumnDescription
CONSTRAINT_CATALOGAlways def.
CONSTRAINT_SCHEMADatabase name, together with CONSTRAINT_NAME identifies the foreign key.
CONSTRAINT_NAMEForeign key name, together with CONSTRAINT_SCHEMA identifies the foreign key.
UNIQUE_CONSTRAINT_CATALOGAlways def.
UNIQUE_CONSTRAINT_SCHEMADatabase name, together with UNIQUE_CONSTRAINT_NAME and REFERENCED_TABLE_NAME identifies the referenced key.
UNIQUE_CONSTRAINT_NAMEReferenced key name, together with UNIQUE_CONSTRAINT_SCHEMA and REFERENCED_TABLE_NAME identifies the referenced key.
MATCH_OPTIONAlways NONE.
UPDATE_RULEThe Update Rule; one of CASCADE, SET NULL, SET DEFAULT, RESTRICT, NO ACTION.
DELETE_RULEThe Delete Rule; one of CASCADE, SET NULL, SET DEFAULT, RESTRICT, NO ACTION.
TABLE_NAMETable name from the TABLE_CONSTRAINTS table.
REFERENCED_TABLE_NAMEReferenced key table name, together with UNIQUE_CONSTRAINT_SCHEMA and UNIQUE_CONSTRAINT_NAME identifies the referenced key.

Comments

Comments loading...