The TABLE_CONSTRAINTS view contains information about which tables have constraints.
| Column | Description |
|---|---|
CONSTRAINT_CATALOG |
The catalog to which the constraint belongs. This value is always def. |
CONSTRAINT_SCHEMA |
The schema (database) to which the constraint belongs. |
CONSTRAINT_NAME |
The name of the constraint. |
TABLE_SCHEMA |
The schema (database) to which the table belongs. |
TABLE_NAME |
The name of the table that has the constraint. |
CONSTRAINT_TYPE |
The type of the constraint: UNIQUE, PRIMARY KEY, FOREIGN KEY, or CHECK. |
ENFORCED |
For CHECK constraints, indicates whether the constraint is enforced (YES or NO). For other constraint types, this value is always YES. |
For more information, see the MySQL documentation: The INFORMATION_SCHEMA TABLE_CONSTRAINTS Table.