首页 > 数据库技术 > 详细

oracle exists和 not exists 的用法

时间:2021-06-24 22:29:41      阅读:26      评论:0      收藏:0      [点我收藏+]
 

比如 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 的用法

原文:https://www.cnblogs.com/lixiuming521125/p/14927961.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!