The TABLE_CONSTRAINTS table describes which tables have constraints.
The TABLE_CONSTRAINTS table has these columns:
-
CONSTRAINT_CATALOGThe name of the catalog to which the constraint belongs. This value is always
def. -
CONSTRAINT_SCHEMAThe name of the schema (database) to which the constraint belongs.
-
CONSTRAINT_NAMEThe name of the constraint.
-
TABLE_SCHEMAThe name of the schema (database) to which the table belongs.
-
TABLE_NAMEThe name of the table.
-
CONSTRAINT_TYPEThe type of constraint. The value can be
UNIQUE,PRIMARY KEY,FOREIGN KEYorCHECK. This is aCHAR(notENUM) column.The
UNIQUEandPRIMARY KEYinformation is about the same as what you get from theKey_namecolumn in the output fromSHOW INDEXwhen theNon_uniquecolumn is0. -
ENFORCEDFor
CHECKconstraints, the value isYESorNOto indicate whether the constraint is enforced. For other constraints, the value is alwaysYES.