Use information_schema.table_constraints table to get the name of the constraints defined on each table:
information_schema.table_constraints
select * from information_schema.table_constraints where constraint_schema = 'YOUR_DB'
Use information_schema.key_column_usage table to obtain the fields in these constraints:
information_schema.key_column_usage
select * from information_schema.key_column_usage where constraint_schema = 'YOUR_DB'
If you want to discuss foreign key constraints, use information_schema.referential_constraints:
information_schema.referential_constraints
select * from information_schema.referential_constraints where constraint_schema = 'YOUR_DB'
Use
information_schema.table_constraints
table to get the name of the constraints defined on each table:Use
information_schema.key_column_usage
table to obtain the fields in these constraints:If you want to discuss foreign key constraints, use
information_schema.referential_constraints
: