mysql获取外键, 根据数据库名和表名获取表所对应的所有外键

SELECT 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:  表名

 

posted @ 2017-02-26 20:01  007少侠  阅读(2051)  评论(0编辑  收藏  举报
友情链接:便宜vps(CN2GIA线路)
站长统计: