1 | select * from emp where sal<(select avg(sal) from emp); |
1 | select * from emp where hiredate= (select MIN(hiredate) from emp); |
1 2 3 4 5 6 7 | select* from emp where (job,sal) =( select job,sal from emp where ename ='scott') and ename <>'scott'; |
1 | select * from emp where sal in (select sal from emp where job = 'manager'); |
1 | select* from emp where sal not in(select sal from emp where job='manager'); |
1 2 3 | select* from emp where sal = any(select sal from emp where job='manager'); select* from emp where sal > any(select sal from emp where job='manager'); |
1 | select* from emp where sal < any(select sal from emp where job='manager'); |
1 2 | select job,count(empno),avg(sal) from emp group by job having avg(sal)>(select avg(sal) from emp); |
1 2 3 | select e.empno,e.ename,e.job, (select d.dname from dept d whered.deptno=e.deptno)from emp e; |
1 2 3 4 5 6 7 | select d.dname,d.loc,count(e.empno) from emp e,dept d where e.deptno(+)=d.deptno group by d.dname,d.loc; |
1 2 3 4 5 6 7 8 9 10 11 12 | 分步1: select d.deptno,d.dname,d.locfrom dept d; 分步2:select deptno,count(empno)from emp group by deptno; 正确的查询: select d.deptno,d.dname,d.loc,temp.count from dept d,(select deptno,count(empno) count from emp group by deptno) temp where d.deptno=temp.deptno(+); |
欢迎光临 度量快速开发平台-专业、快速的软件定制快开平台 (http://plat.delit.cn/) | Powered by Discuz! X3.2 |