mysql如何获取两个表的diff数据

复制一个表的表结构:

create table new_table_name like old_table_name;

删除表中的全部记录:

delete from tablename where 1=1;

mysql将一个表里面的数据批量导入另一个表里:

insert into new_table(`name`,`age`) select `name`,`age` from old_table;
 
mysql获取表1和表2的diff数据(表1里面有,表2里面没有的数据):
 
select `keyword`,`cityId` from table1 where not exists (select `keyword`,`cityId` from table2 where table1.keyword=table2.keyword and table1.cityId=table2.cityId)
原文地址:https://www.cnblogs.com/zhaijing/p/7117126.html