Information Schema KEY_COLUMN_USAGE Table
The Information Schema KEY_COLUMN_USAGE
table shows which key columns have constraints.
It contains the following columns:
Column
Description
CONSTRAINT_CATALOG
Always def.
CONSTRAINT_SCHEMA
Database name of the constraint.
CONSTRAINT_NAME
Name of the constraint (PRIMARY for the primary key).
TABLE_CATALOG
Always #def.
TABLE_SCHEMA
Database name of the column constraint.
TABLE_NAME
Table name of the column constraint.
COLUMN_NAME
Column name of the constraint.
ORDINAL_POSITION
Position of the column within the constraint.
POSITION_IN_UNIQUE_CONSTRAINT
For foreign keys, the position in the unique constraint.
REFERENCED_TABLE_SCHEMA
For foreign keys, the referenced database name.
REFERENCED_TABLE_NAME
For foreign keys, the referenced table name.
REFERENCED_COLUMN_NAME
For foreign keys, the referenced column name.
Example
See Also
This page is licensed: CC BY-SA / Gnu FDL
Last updated
Was this helpful?