TABLE_CONSTRAINTS 表描述了哪些表具有约束。The TABLE_CONSTRAINTS table describes
which tables have constraints.
TABLE_CONSTRAINTS 表包含以下列:The TABLE_CONSTRAINTS table has these
columns:
CONSTRAINT_CATALOGCONSTRAINT_CATALOG约束所属的目录名称。该值始终为
def。The name of the catalog to which the constraint belongs. This value is alwaysdef.CONSTRAINT_SCHEMACONSTRAINT_SCHEMA约束所属的模式(数据库)名称。The name of the schema (database) to which the constraint belongs.
CONSTRAINT_NAMECONSTRAINT_NAME约束的名称。The name of the constraint.
TABLE_SCHEMA表所属的模式(数据库)名称。The name of the schema (database) to which the table belongs.
TABLE_NAMETABLE_NAME表的名称。The name of the table.
CONSTRAINT_TYPE约束的类型。值可以是
UNIQUE、PRIMARY KEY、FOREIGN KEY或CHECK。这是一个CHAR(不是ENUM)列。The type of constraint. The value can beUNIQUE,PRIMARY KEY,FOREIGN KEYorCHECK. This is aCHAR(notENUM) column.UNIQUE和PRIMARY KEY信息与从SHOW INDEX输出中的Key_name列获取的信息差不多,当Non_unique列为0时。TheUNIQUEandPRIMARY KEYinformation is about the same as what you get from theKey_namecolumn in the output fromSHOW INDEXwhen theNon_uniquecolumn is0.ENFORCEDENFORCED对于
CHECK约束,值为YES或NO,以表示该约束是否已执行。对于其他约束,值始终为YES。ForCHECKconstraints, the value isYESorNOto indicate whether the constraint is enforced. For other constraints, the value is alwaysYES.