Skip to content

Instantly share code, notes, and snippets.

@hr-sadooghi
Created February 27, 2017 07:28
Show Gist options
  • Save hr-sadooghi/e10224ea7e97872dcb41382984883d79 to your computer and use it in GitHub Desktop.
Save hr-sadooghi/e10224ea7e97872dcb41382984883d79 to your computer and use it in GitHub Desktop.
MySQL: How do I find out which tables reference a specific table?
select table_name
from information_schema.KEY_COLUMN_USAGE
where table_schema = 'database_name'
and referenced_table_name = 'table_name';
-- http://stackoverflow.com/questions/754512/mysql-how-do-i-find-out-which-tables-reference-a-specific-table/754582#754582
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment