oracle - 找出他们部门内平均工资超过 8000 的员工
问题描述
我试图找到员工的平均工资高于8000
他们的department
我得到的avg(salary)
部门内大于8000
但无法显示名称
select avg(salary) from employees group by department_id having avg(salary)> 8000
它显示员工姓名
解决方案
尝试这个:
Select department_id, emp_name, salary from
(select department_id, emp_name, salary, avg(salary) over(partition by department_id) as avg_salary
from employees)
Where avg_salary >= 8000
AND salary >= 8000; -- ADDED THIS CONDITION
以上查询将返回部门内所有员工平均工资大于8000的员工,包括部门id、员工姓名和工资。
干杯!!
推荐阅读
- python - 将拉普拉斯金字塔图像放在黑色画布上会改变背景
- php - php中不显示数据
- c# - 非常基本的控制台应用程序,带有 CastleWindsor、Rebus、RabbitMQ。为什么“此容器中已注册 IBus 服务”?
- python-2.7 - 没有任何按钮的 Tkinter 消息框
- scala - 将整数转换为日期以计算天数
- java - 在 kotlin 中删除包装类的样板
- c++ - GProf:__cosl_internal 和 __sinl_internal 函数是什么?
- processing - 如何将音频频谱展开成网格
- geometry - 我怎样才能反转?坐标空间?
- python - 字符串索引必须是整数 Giphy