Created
October 24, 2013 11:07
-
-
Save ReeMii/7135232 to your computer and use it in GitHub Desktop.
get table relations
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 | |
constraint_schema as db, | |
CONCAT( table_name, '.', column_name, ' -> ', referenced_table_name, '.', referenced_column_name ) AS relationship | |
FROM | |
information_schema.key_column_usage | |
WHERE | |
referenced_table_name = 'TableName' | |
ORDER BY | |
constraint_schema, table_name, column_name; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment