Created
March 4, 2018 01:58
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------------------------------------------------------------------------ | |
--- 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