Created
March 4, 2013 18:51
-
-
Save kany/5084473 to your computer and use it in GitHub Desktop.
Find Foreign Keys - Mysql
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 | |
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 is not null AND | |
referenced_table_name = 'org_units'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment