sql1: select * from t1 where not exists (select a from t2 where t2.a = t1.a);
sql2: select * from t1 where t1.a not in (select a from t2 where t2.a is not null);
I think the sql1 is same as sql2, they will rewrite to anti join, right?
sql1: select * from t1 where not exists (select a from t2 where t2.a = t1.a);
sql2: select * from t1 where t1.a not in (select a from t2 where t2.a is not null);
I think the sql1 is same as sql2, they will rewrite to anti join, right?
The two queries will give different results if you have
NULL
values.Example in Oracle:
Output: