题解 | 分析员工在不同项目中的绩效表现以及所属部门的平均绩效情况

分析员工在不同项目中的绩效表现以及所属部门的平均绩效情况

https://www.nowcoder.com/practice/20c76a1181004965a3106524fd3ab583

-- 逻辑拆解:查找绩效得分高于部门平均分的员工,那么要先把部门员工平均分找出来,再去比对
With avg_performance AS(
    SELECT t2.department_name,AVG(t1.performance_score) performance_score
    FROM employee_projects t1
    LEFT JOIN department_info t2
    ON t1.employee_id = t2.employee_id
    GROUP BY t2.department_name
),
table_2 AS(
    SELECT t1.employee_id,t2.department_name,t1.performance_score
    FROM employee_projects t1
    LEFT JOIN department_info t2
    ON t1.employee_id = t2.employee_id
)

SELECT t1.employee_id,t1.department_name,t1.performance_score
FROM table_2 t1
INNER JOIN avg_performance t2
ON t1.department_name = t2.department_name
WHERE t1.performance_score > t2.performance_score

全部评论

相关推荐

不愿透露姓名的神秘牛友
07-15 17:09
点赞 评论 收藏
分享
05-26 22:25
门头沟学院 Java
Java小肖:不会是想叫你过去把你打一顿吧,哈哈哈
点赞 评论 收藏
分享
06-12 17:46
门头沟学院 Java
运营你豪哥:来说重点: ​1.项目前置,时间倒序。​​ 2.​项目描述强化结果与量化效果(STAR原则里的R)。​​ ​3.个人技能精炼,明确掌握程度,突出核心。​​ ​4.增加强有力开头的个人总结部分。​​ 5.​优化教育背景(成绩排名)、合并奖项与活动。​​
听劝,我这个简历该怎么改...
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务