刚接手MySQL数据的时候,经常会遇到主外键关系,有没有E-R图来帮助,职能通过SQL来查询:

select
TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME, REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME
from INFORMATION_SCHEMA.KEY_COLUMN_USAGE
where
REFERENCED_TABLE_NAME = '<table>';