mysql获取外键, 根据数据库名和表名获取表所对应的所有外键
时间:2021-07-01 10:21:17
帮助过:39人阅读
ii.`COLUMN_NAME`
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
AS ii
WHERE ii.`CONSTRAINT_SCHEMA`
=‘xius‘ AND ii.`TABLE_NAME`
=‘comment_user‘ AND ii.`REFERENCED_COLUMN_NAME`
!= ‘null‘;
xius: 数据库名
comment_user: 表名
mysql获取外键, 根据数据库名和表名获取表所对应的所有外键
标签:form color schema sel blog com and code 数据库名