Skip to content

Instantly share code, notes, and snippets.

@kvn1234
Created August 10, 2018 17:15
Show Gist options
  • Save kvn1234/d18c093ce7a8f72a5d41a79e6501b297 to your computer and use it in GitHub Desktop.
Save kvn1234/d18c093ce7a8f72a5d41a79e6501b297 to your computer and use it in GitHub Desktop.
Find foreign keys from information_schema
SELECT * FROM KEY_COLUMN_USAGE WHERE REFERENCED_TABLE_NAME = 'table_name' AND REFERENCED_COLUMN_NAME = 'id'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment