子查询
如何查询和部门10 的工作相同的雇员的名字,岗位,工资。部门
select * from emp where job in(selelct distinct job from emp where deptno=10 )
如何显示工资比部门30的所有员工的工资高的员工的姓名,工资和部门号
select ename,dept from emp where sal>all(select sal from emp where deptno=30) ;
select * from emp where sal>(select max(sal) from emp where deptno=30);
在多行子查询中使用any操作符
如何显示工资比部门30的任意一个员工的工资高的员工的姓名 工资和部门号
select emae ,sal ,dept from emp where sal> any (select sal from emp where deptno=30);
本文介绍并演示了如何使用SQL子查询来检索特定条件的数据。包括查找与特定部门工作相同的雇员信息、找出薪资高于某部门所有员工的人员等实用案例。
57

被折叠的 条评论
为什么被折叠?



