Skip to content

Instantly share code, notes, and snippets.

@clairtonluz
Last active August 29, 2015 13:56
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 clairtonluz/9072360 to your computer and use it in GitHub Desktop.
Save clairtonluz/9072360 to your computer and use it in GitHub Desktop.
showForeignKeys
use INFORMATION_SCHEMA;
select TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME,
REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME from KEY_COLUMN_USAGE where
REFERENCED_TABLE_NAME = 'nomeDaTabelaPai';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment