Created
July 18, 2018 15:18
-
-
Save mikemill/ac5a7347b18aef0c0bfa179b9c95dde1 to your computer and use it in GitHub Desktop.
MySQL Foreign Key references
This file contains hidden or 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 | |
| TABLE_NAME, | |
| COLUMN_NAME, | |
| CONSTRAINT_NAME, | |
| REFERENCED_TABLE_NAME, | |
| REFERENCED_COLUMN_NAME, | |
| UPDATE_RULE, | |
| DELETE_RULE | |
| FROM | |
| INFORMATION_SCHEMA.KEY_COLUMN_USAGE AS kcu | |
| JOIN | |
| INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS USING ( | |
| CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_NAME, | |
| TABLE_NAME, REFERENCED_TABLE_NAME) | |
| WHERE | |
| REFERENCED_TABLE_SCHEMA = 'launchpad' AND | |
| REFERENCED_TABLE_NAME IN ('lpdays') | |
| -- AND REFERENCED_COLUMN_NAME = 'TermID' | |
| ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment