当前位置:Gxlcms > mysql > 关于Oracle数据库删除、查询(三)

关于Oracle数据库删除、查询(三)

时间:2021-07-01 10:21:17 帮助过:10人阅读

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');(标红两处顺序要一致)

人气教程排行