2020-08-20
阅读量:
1237
子查询的相关操作符([not] in,any和all)
例:
1.[not] in
查询员工数不少于5人的部门所有员工,显示empno,ename,sal,grade
select *from emp
where deptno in(select deptno from emp group by deptno having count(*)>=5);
2.ANY
查询基本工资高于30号部门任意员工的其他部门员工信息
select * from emp
where sal>any(select sal from emp where deptno=30) and deptno<>30;
3.ALL
查询基本工资高于30号部门所有员工的员工信息
select * from emp
where sal>all(select sal from emp where deptno=30);






评论(0)


暂无数据
推荐帖子
0条评论
1条评论
0条评论