a.单行子查询(适用于>,<,=,>=,<=等条件)
//查询工资最高的员工编号和员工名
select empno,ename
from emp
where sal=(select max(sal) from emp);
//查询最新入职的员工编号和员工名
select empno,ename
from emp
where hiredate=(select max(hiredate) from emp);
//查询大于平均工资的员工名和工资
select ename,sal
from emp
where sal>(select avg(sal) from emp);
//查询与SCOTT在同一个部门的同事的编号和名称
select empno,ename
from emp
where deptno=(select deptno
from emp where ename='SCOTT');