/*删除表前,查询某个表所有关联的外检,然后获取删除sql语句执行*/
select
TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME, REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME, CONCAT('alter table ',TABLE_NAME,' drop foreign key ',CONSTRAINT_NAME,';') DELETESQL
from INFORMATION_SCHEMA.KEY_COLUMN_USAGE
where
REFERENCED_TABLE_NAME = 't_s_role';