关于Oracle数据库删除、查询(三)
select a1.ename,a1.sal,a2.grade from emp a1,salgrade a2 where a1.sal between a2.losal and a2.hisal; select worker.ename,boss.ename from emp worker,emp boss where worker.mgr=boss.empno and worker.mgr='FOLD'; select * from emp where deptno=(
select a1.ename,a1.sal,a2.grade from emp a1,salgrade a2 where a1.sal between a2.losal and a2.hisal;
select worker.ename,boss.ename from emp worker,emp boss where worker.mgr=boss.empno and worker.mgr='FOLD';
select * from emp where deptno=(select deptno from emp where ename='SMITH');
select * from emp where job in(select distinct job from emp where deptno=10);
select ename,sal,deptno from emp where sal>all(select sal from emp where deptno=30);
别的写法:
select ename,sal,deptno from emp where sal>(select
max(sal) from emp where deptno=30);
select * from emp where (deptno,job)=(select septno,job from emp where ename='SMITH');(标红两处顺序要一致)