查询 A库中存在但B库中不存在的表名以及字段名
1、假设有库A和库B
2、库A和库B都在同一台服务器上
3、要查询A库中存在,但是B库中不存在的表以及字段有哪些,即可执行以下sql语句
select a.col_name
from (select *,concat(table_name,' ',column_name) col_name from information_schema.`COLUMNS` where table_schema = 'A') a
left join (select concat(table_name,' ',column_name) col_name from information_schema.`COLUMNS` where table_schema = 'B') b
on a.col_name = b.col_name where b.col_name is null