Skip to content

Instantly share code, notes, and snippets.

@jfriv
Created March 4, 2018 01:58
Show Gist options
  • Save jfriv/2b6fcd9b2f8e77c20d39d57c75a584f1 to your computer and use it in GitHub Desktop.
Save jfriv/2b6fcd9b2f8e77c20d39d57c75a584f1 to your computer and use it in GitHub Desktop.
MySQL find all tables which reference another table with a foreign key constraint
------------------------------------------------------------------------------
--- select all tables which have FKs that reference a table
------------------------------------------------------------------------------
SELECT *
FROM information_schema.REFERENTIAL_CONSTRAINTS
WHERE referenced_table_name LIKE '%{table}%';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment