KEY_COLUMN_USAGE

The KEY_COLUMN_USAGE view shows which key columns are involved in constraints. It doesn’t include functional key parts, because those are expressions rather than actual columns.

Column Description
CONSTRAINT_CATALOG The catalog that contains the constraint. This value is always def.
CONSTRAINT_SCHEMA The schema (database) that contains the constraint.
CONSTRAINT_NAME The name of the constraint.
TABLE_CATALOG The catalog that contains the table. This value is always def.
TABLE_SCHEMA The schema (database) that contains the table.
TABLE_NAME The name of the table on which the constraint is defined.
COLUMN_NAME The name of the column included in the constraint. For foreign keys, this is the referencing column, not the referenced column.
ORDINAL_POSITION The column’s position within the constraint (starting at 1), not its position in the table.
POSITION_IN_UNIQUE_CONSTRAINT For foreign keys, the column’s position in the referenced key. NULL for primary key and unique constraints.
REFERENCED_TABLE_SCHEMA The schema of the referenced table.
REFERENCED_TABLE_NAME The name of the referenced table.
REFERENCED_COLUMN_NAME The name of the referenced column.

For more information, see the MySQL documentation: The INFORMATION_SCHEMA KEY_COLUMN_USAGE Table.