码迷,mamicode.com
首页 > 数据库 > 详细

oracle exists和 not exists 的用法

时间:2019-12-01 17:19:15      阅读:81      评论:0      收藏:0      [点我收藏+]

标签:rom   ora   select   用法   size   col   sts   style   存在   

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

标签:rom   ora   select   用法   size   col   sts   style   存在   

原文地址:https://www.cnblogs.com/houchen/p/11966389.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!