oracle exists和 not exists 的用法

Posted 你所学的知识,就是你持有的武器

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了oracle exists和 not exists 的用法相关的知识,希望对你有一定的参考价值。

比如 a,b 关联列为 a.id = b.id,现在要取 a 中的数据,其中id在b中也存在:

select * from a where exists(select 1 from b where b.id = a.id)

或者:
现在要取 a 中的数据,其中id在b中 不存在:

select * from a where not exists(select 1 from b where a.id = b.id)

以上是关于oracle exists和 not exists 的用法的主要内容,如果未能解决你的问题,请参考以下文章