How to show constraints in MySQL
Working in Postgres, I've gotten used to seeing the contraints on a table listed with \d
. Working in MySQL I wasn't seeing similar with describe <table>;
. Turns out you can see all the constraints by selecting from information_schema.referential_constraints
:
SELECT *
FROM information_schema.referential_constraints
WHERE constraint_schema='db_name'
AND table_name='table_of_interest';
Tweet