Last active
June 20, 2020 23:07
-
-
Save midnite81/9dc1e8e6b3a9c43121e7b8a15c4b1098 to your computer and use it in GitHub Desktop.
Gets foreign keys for a column
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
SET @tableName = '<table_name>'; | |
SET @columnName = '<column_name>'; | |
SELECT table_name, column_name, referenced_table_name, referenced_column_name | |
FROM information_schema.key_column_usage | |
WHERE table_name = @tableName AND column_name = @columnName; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment