select d.*,my.ct from dept d,
(select count(empno) ct,deptno
from emp
group by deptno having count(empno)>=1) my
where d.deptno=my.deptno;
select * from emp
where sal>(select sal from emp where ename='SMITH');
select e.ename,e2.ename from emp e,emp e2
where e.mgr=e2.empno(+);
select e.ename,e.empno,d.dname from emp e,emp e2,dept d
where e.mgr=e2.empno and e.hiredate<e2.hiredate and e.deptno=d.deptno;
select e.ename,d.dname,my.c
from emp e,dept d,(select count(empno) c,deptno from emp group by(deptno)) my
where e.job='CLERK' and e.deptno=d.deptno and e.deptno=my.deptno;
评论0
最新资源