key_column_usage

The key_column_usage view provides information about columns restricted by key constraints.

Column name Data type Description
constraint_catalog sql_identifier The name of the current database containing the constraint.
constraint_schema sql_identifier The name of the schema containing the constraint.
constraint_name sql_identifier The name of the constraint.
table_catalog sql_identifier The name of the current database holding the table that contains the column restricted by this constraint.
table_schema sql_identifier The name of the schema holding the table that contains the column restricted by this constraint.
table_name sql_identifier The name of the table holding the column restricted by this constraint.
column_name sql_identifier The name of the column restricted by this constraint.
ordinal_position cardinal_number The ordinal position of the column within the constraint key. The count starts at 1.
position_in_unique_constraint cardinal_number For a foreign-key constraint, the ordinal position of the referenced column within its unique constraint. The count starts at 1.
NULL – The constraint is not a foreign key.