Skip to content

Instantly share code, notes, and snippets.

@sevaldes
Created November 6, 2017 10:56
Show Gist options
  • Select an option

  • Save sevaldes/e16fd5c520a1f25935e1e1d47515de9b to your computer and use it in GitHub Desktop.

Select an option

Save sevaldes/e16fd5c520a1f25935e1e1d47515de9b to your computer and use it in GitHub Desktop.
SQL query to find FK references to specific table
SELECT *
FROM
information_schema.KEY_COLUMN_USAGE
WHERE
REFERENCED_TABLE_SCHEMA = 'objective_schema'
AND REFERENCED_TABLE_NAME = 'objective_table'
AND REFERENCED_COLUMN_NAME = 'objective_fk_column';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment