列出薪水高于所在部门平均工资的员工信息( )。
A. select deptno,ename,sal from emp a where sal>(select avg(a.sal) from emp where deptno=a.deptno);
B. select deptno,ename,sal from emp a where sal>(select avg(sal) from emp where deptno=a.deptno);
C. select a.deptno,a.ename,a.sal from emp a,emp b where a.deptno=b.deptno and a.sal>avg(b.sal);
D. select a.deptno,a.ename,a.sal from emp a,emp b where a.deptno=b.deptno and b.sal>avg(a.sal);
列出没有职工的部门( )。
A. select dept.deptno from emp,deptwhere emp.deptno(+)=dept.deptnoand emp.deptno is null;
B. select dept.deptno from emp,deptwhere emp.deptno(+)=dept.deptnoand dept.deptno is null;
C. select dept.deptno from emp,deptwhere emp.deptno(+)=dept.deptnoand emp.deptno=null;
D. select dept.deptno from emp,deptwhere emp.deptno=dept.deptno(+)and dept.deptno is null;
列出所有部门的职工人数(包括没有职工的部门) ( )。
A. select dept.deptno,dname,count(emp.empno)from emp,dept where emp.deptno=dept.deptnogroup by dept.deptno,dname;
B. select dept.deptno,dname,count(emp.empno)from emp,dept where emp.deptno(+)=dept.deptnogroup by dept.deptno,dname;
C. select dept.deptno,dname,count(emp.empno)from emp,dept where emp.deptno=dept.deptno(+)group by dept.deptno,dname;
D. select dept.deptno,dname,count(emp.empno)from emp,dept where emp.deptno(+)=dept.deptno(+)group by dept.deptno,dname;