Skip to content

Instantly share code, notes, and snippets.

@arabsalem
Created February 6, 2014 09:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arabsalem/8840990 to your computer and use it in GitHub Desktop.
Save arabsalem/8840990 to your computer and use it in GitHub Desktop.
List foreign keys in mysql
select
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
and table_schema = 'gms.drc.dk'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment