Bookmark and Share
How to find out all tables which refer a table's column as a foreign key?
(Publish Date: 2009-9-3 3:15pm, Total Visits: 1074, Today: 1, This Week: 2, This Month: 5)

mysql > select concat(table_name, '.', column_name) as 'foreign key',
concat(referenced_table_name, '.', referenced_column_name) as 'references'
from information_schema.key_column_usage
where referenced_table_name = "syndicate";

+-------------------------------+------------------------+
| foreign key                   | references |
+-------------------------------+------------------------+
| article_rights.syndicate_id | syndicate.syndicate_id |
| image_rights.syndicate_id | syndicate.syndicate_id |
| image_rights_old.syndicate_id | syndicate.syndicate_id |
| media_rights.syndicate_id | syndicate.syndicate_id |
| partner_promo.syndicate_id | syndicate.syndicate_id |
| syndicate_feed.syndicate_id | syndicate.syndicate_id |
| x_syndicate_site.syndicate_id | syndicate.syndicate_id |
+-------------------------------+------------------------+