Updated on 2025-10-23 GMT+08:00

table_constraints

The table_constraints view describes which tables have constraints. This view is read-only. All users have the read permission on this view.

Table 1 information_schema.table_constraints columns

Name

Type

Description

CONSTRAINT_CATALOG

varchar(512)

Name of the database to which the constraint belongs. When lower_case_table_names is set to 0, the value of this column is case-sensitive. When lower_case_table_names is set to 1, the value of this column is case-insensitive.

CONSTRAINT_SCHEMA

varchar(64)

Name of the schema to which the constraint belongs. When lower_case_table_names is set to 0, the value of this column is case-sensitive. When lower_case_table_names is set to 1, the value of this column is case-insensitive.

CONSTRAINT_NAME

varchar(64)

Name of the constraint. If the constraint is a primary key constraint, PRIMARY is displayed.

TABLE_SCHEMA

varchar(64)

Name of the schema to which the table belongs. When lower_case_table_names is set to 0, the value of this column is case-sensitive. When lower_case_table_names is set to 1, the value of this column is case-insensitive.

TABLE_NAME

varchar(64)

Name of the table. When lower_case_table_names is set to 0, the value of this column is case-sensitive. When lower_case_table_names is set to 1, the value of this column is case-insensitive.

CONSTRAINT_TYPE

varchar(64)

Type of the constraint. The value is unique, primary key, foreign key, or check.