区别:
in:
where id in(x1,x2)等同于where id=x1 or id=x2
not in:
where id not in(x1,x2)等同于where id!=x1 and id!=x2
exists:
where exists(select ......);select 子查询有结果则“exists(select ......)”返回true,否则返回false,等同于where
true(false)
not exists:
where not exists(select ......);select 子查询有结果则“not exists(select ......)”返回false,否则返回true,等同于where false(true)
本文详细解释了SQL查询中in、notin及exists等条件的区别与用法。in用于匹配指定集合内的值;notin则用于排除指定集合内的值;exists用于判断子查询是否有结果返回。
745

被折叠的 条评论
为什么被折叠?



