Skip to content

Instantly share code, notes, and snippets.

@IcyMidnight
Created June 19, 2009 10:05
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IcyMidnight/132538 to your computer and use it in GitHub Desktop.
Save IcyMidnight/132538 to your computer and use it in GitHub Desktop.
Show All Foreign Keys in MySQL
SELECT constraint_schema AS `database`, constraint_name, 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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment