
关于Oracle中in和exists的区别
1个回答
展开全部
是这样的
in 是返回的结果集
比如你只运行这一句
select sno from sc where cno='c002'
返回的是一列sno
但是exists则不同,返回的是布尔值
虽然里边那个没法单独运行
select * from sc a where cno='c001' and exists(select sno from sc b where cno='c002' and a.sno=b.sno) ;
后边必须要写上两者的关联
in 是返回的结果集
比如你只运行这一句
select sno from sc where cno='c002'
返回的是一列sno
但是exists则不同,返回的是布尔值
虽然里边那个没法单独运行
select * from sc a where cno='c001' and exists(select sno from sc b where cno='c002' and a.sno=b.sno) ;
后边必须要写上两者的关联
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询