时间:2021-07-01 10:21:17 帮助过:29人阅读
select * from a where id in (select id from b)
等价于:
for select id from b
for select 8 from a where a.id = b.id
当b表数据必须小于a表数据时,in优于exists
select * from a where exists (select 1 from b where b.id = a.id)
等价于:
for select * from a
for select * from b where b.id = a.id
防止exists优于in
mysql查询优化
标签:sql查询 必须 表数 sel exist 等价 where 表数据 查询优化