exists:
select * from a where exists( 查询a表中包含b表id的数据
select id from b where id=a.id
);
根据名字查询重名的人,并且统计重名人的人数
select name count(*) from a group by name having count(*) > 1;
exists:
select * from a where exists(
select * from b where b.id=a.id
) 查询出a在b中存在的数据
select * from a where not exists(
select * from b where b.id=a.id
) 查询出a在b中没有的数据