热线电话:13121318867

登录
2020-08-20 阅读量: 1237
子查询的相关操作符([not] in,any和all)

image.png

例:

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);


29.9467
0
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子