ORACLE 子查询 嵌套查询 多值子查询
时间:2020-01-11 12:10:34
收藏:0
阅读:306
用exist 当作布尔值来处理,当查询语句有结果时 返回true, 否则返回false.
1 select * from emp where exists (select * from emp where neo=123);
1 --查询有员工的部门的信息 2 3 select * from dept d1 where exists(select * from emp e1 where e1.deptno = d1.deptno );
1 --查询不是领导的信息(含null值正确写法) 2 3 select * from emp where empno not in (select mgr from emp where mgr is not null); --查询出8条记录
原文:https://www.cnblogs.com/smartisn/p/12179228.html
评论(0)