mysql show foreign keys

Solutions on MaxInterview for mysql show foreign keys by the best coders in the world

showing results for - "mysql show foreign keys"
Luis
14 Nov 2019
1SELECT 
2  TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME, REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME
3FROM
4  INFORMATION_SCHEMA.KEY_COLUMN_USAGE
5WHERE
6  REFERENCED_TABLE_SCHEMA = '<database>' AND
7  REFERENCED_TABLE_NAME = '<table>';
Ester
09 Oct 2017
1SELECT 
2  TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME, REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME
3FROM
4  INFORMATION_SCHEMA.KEY_COLUMN_USAGE
5WHERE
6  REFERENCED_TABLE_SCHEMA = '<database>' AND
7  REFERENCED_TABLE_NAME = '<table>' AND
8  REFERENCED_COLUMN_NAME = '<column>';