查询每个部门的平均工资(而且显示部门名称)。
1* select deptno,avg(sal) from emp group by deptno having (deptno in (select deptno from dept))
SQL> /
DEPTNO AVG(SAL)
---------- ----------
30 1566.66667
20 2175
10 2916.66667
SQL> select deptno,avg(sal) from emp group by deptno;
DEPTNO AVG(SAL)
---------- ----------
30 1566.66667
20 2175
10 2916.66667
就是查找每个部门名称和部门平均工资:
select dname,avg(sal) from (select dname,emp.* from emp,dept where dept.deptno=emp.deptno) group by
dname;
DNAME AVG(SAL)
-------------- ----------
ACCOUNTING 2916.66667
RESEARCH 2175
SALES 1566.66667
最后
以上就是强健果汁最近收集整理的关于求每个部门的平均工资的全部内容,更多相关求每个部门内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复