Skip to content

Instantly share code, notes, and snippets.

@tomzx
Created January 23, 2014 19:09
Show Gist options
  • Save tomzx/8584838 to your computer and use it in GitHub Desktop.
Save tomzx/8584838 to your computer and use it in GitHub Desktop.
List all FK relations
SELECT
ke.referenced_table_name parent,
ke.table_name child,
ke.constraint_name
FROM
information_schema.KEY_COLUMN_USAGE ke
WHERE
ke.referenced_table_name IS NOT NULL
ORDER BY
ke.referenced_table_name;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment