EXISTS 执行顺序

select * from a where a.s_status=1 and exists (select orderid from b where a.orderid=b.orderid)

exists执行顺序

1.首先exists 返回的是true或false

2.查询一条a的数据,会去执行exists 若返回true则存在结果集中,再执行a的下一条数据,直到a的数据执行完

3.exists 里的数据是怎么执行的呢?只要满足条件就会返回true,没必要把b表中的数据都查询一遍

 

原文地址:https://www.cnblogs.com/xiaxiaomo/p/8986633.html