【发布时间】:2014-02-17 22:06:28
【问题描述】:
我正在使用 oracle 11g。我想知道为什么这两个查询给出不同的答案?
在逻辑上它们是相同的:
select * from tableA where
exists (select * from tableB where tableA.ID != tableB.ID);
select * from tableA where
not exists (select * from tableB where tableA.ID = tableB.ID);
在第一个中,我选择了所有不存在的东西。
在第二个中,我没有选择所有存在的东西。
注意(“存在”改为“不存在”)和(“!=”改为“=”)
看起来一样吧?但他们给出了完全不同的答案
【问题讨论】: