DQL语言-子查询【九】

今天爱分享给大家带来DQL语言-子查询【九】,希望能够帮助到各位。

  • 单行子查询:>、>=、<、<=、!=、<>、=、<=>
  • 多行子查询:in、not in、any、some、all、exits

1、in的使用

--查询所有经理的信息
select * from emp where empno in (select mgr from emp where mgr is not null);

 
2、not in的使用;

--查询不是经理的信息
select * from emp where empno not in (select mgr from emp where mgr is not null);

3、any的使用
 

--查询出比10号部门任意一个员工薪资高的员工信息
select * from emp where sal > any (select sal from emp where deptno = 10);

4、some的使用

--查询出比10号部门任意一个员工薪资高的员工信息
select * from emp where sal > some (select sal from emp where deptno = 10);

 

5、all的使用

--查询出比20号部门所有员工薪资高的员工信息
select * from emp where sal > all (select sal from emp where deptno = 20);

6、exits的使用

--查询有员工的部门的信息
select * from dept d1 where exists (select * from emp e1 where e1.deptno = d1.deptno);
原文链接:https://blog.itblood.com/134.html,转载请注明出处。
0
NTR之谜v0.6 AI版[PC+安卓/1.84G/更新]The Mystery of NTR [v0.6] [亚洲SLG/汉化/动态]
NTR之谜v0.6 AI版[PC+安卓/1.84G/更新]The Mystery of NTR [v0.6] [亚洲SLG/汉化/动态]
6分钟前 有人购买 去瞅瞅看

站点公告

显示验证码
没有账号?注册  忘记密码?