Scott Wolf Scott Wolf - 2 years ago 75
SQL Question

View all foreign key constraints for entire MySQL database

I have a large database with over 150 tables that I've recently been handed. I'm just wondering if there is an easy way to view all foreign key constraints for the entire DB instead of on a per-table basis.

Answer Source

You can use the INFORMATION_SCHEMA tables for this. For example, the INFORMATION_SCHEMA TABLE_CONSTRAINTS table.

Something like this should do it:

select *
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download