How to View Primary and Foreign Key Constraints on Tables
In order to verify previously established primary and foreign key (PK/FK) relationships, you can utilize the command SHOW CREATE TABLE. This command displays the SQL statement required to recreate the specified table in its current state.
Example:
To examine the constraints on the practices and cred_insurances tables in the credentialing1 database, execute the following command:
SHOW CREATE TABLE practices; SHOW CREATE TABLE cred_insurances;
The output will include information about table columns, data types, and constraint definitions. This allows you to confirm the PK and FK relationships you have set.
The above is the detailed content of How to Check Primary and Foreign Key Constraints in MySQL?. For more information, please follow other related articles on the PHP Chinese website!