简单理解EXISTS的用法
select column_name
from talbe_name
where [not] exists (subquery)
只要subquery有记录就返回true,否则返回false。
首先取主表的一行记录与子表关联,然后形成一个虚拟的表信息,如果虚拟表有信息表示返回True 否则返回false not exists刚好相反。然后主表在移到下一行记录
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/13996372/viewspace-623798/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/13996372/viewspace-623798/