sql 关于in 和EXISTS 的区别

in 不匹配 null 值,
EXISTS 匹配 null值。

下面的例子不能运行:
select count(*)  from (select p5 from wgqtest where not  EXISTS(select a.emp_code from base_employee a))

select count(*) from wgqtest where p5 in (select a.emp_code from base_employee a)
select count(*) from wgqtest where p5 not in (null)
select count(*) from wgqtest where p5 is not null

select a.emp_code from base_employee a where emp_code is null

select p5 from wgqtest



你可能感兴趣的:(sql)