Created
February 14, 2013 20:28
-
-
Save yellow5/4956103 to your computer and use it in GitHub Desktop.
Query to list all foreign keys for a given schema in 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 table_name, constraint_name | |
FROM information_schema.table_constraints | |
WHERE | |
table_schema = 'DATABASE_NAME' AND | |
constraint_type= 'FOREIGN KEY' | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment