KEY_COLUMN_USAGE
Applies to: Databricks SQL Databricks Runtime 11.3 LTS and above Unity Catalog only
Preview
This feature is in Public Preview.
INFORMATION_SCHEMA.KEY_COLUMN_USAGE lists the columns of the primary or foreign key constraints within the catalog.
The rows returned are limited to constraints on the tables, depending on user privileges.
Definition
The KEY_COLUMN_USAGE
relation contains the following columns:
Name |
Data type |
Nullable |
Standard |
Description |
---|---|---|---|---|
|
|
No |
Yes |
Catalog containing the constraint. |
|
|
No |
Yes |
Schema containing the constraint. |
|
|
No |
Yes |
Name of the constraint. |
|
|
No |
Yes |
Catalog containing the table. |
|
|
No |
Yes |
Schema containing the table. |
|
|
No |
Yes |
Name of the table in which the constraint is defined. |
|
|
No |
Yes |
Name of the column. |
|
|
No |
Yes |
Position (1-based) of the column in the key. |
|
|
Yes |
Yes |
For foreign key, position (1-based) of the column in parent unique or primary key constraint, |
Constraints
The following constraints apply to the KEY_COLUMN_USAGE
relation:
Class |
Name |
Column List |
Description |
---|---|---|---|
Primary key |
|
|
Uniquely identifies the relation. |
Unique key |
|
|
Uniquely identifies the relation. |
Unique key |
|
|
Uniquely identifies the relation. |
Foreign key |
|
|
References COLUMNS. |
Foreign key |
|
|
References TABLE_CONSTRAINTS. |