exists 用于 where 关键字后, 后面的条件语句一定是查询语句且返回的是布尔类型
例如:
select from a where exists (select b_id from b where b.b_name = a.a_name)
当条件语句 select b_id from b where b.b_name = a.a_name 有值时, 就是 true, 就等同于执行了这个条件语句 where 后面的部分那么整个 sql 语句等同于:
select from a where a_name in (select b_name from b)
来源: http://www.bubuko.com/infodetail-2498122.html