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