题解 | 分析每个员工在不同项目中的绩效情况
分析每个员工在不同项目中的绩效情况
https://www.nowcoder.com/practice/fa64fd2eb40d4639bc23dfb1ffae2163
## 先在with中处理其他列,再在主查询中写员工姓名和部门
with t as (
select employee_id,
performance_score as first_half_2024_score,
project_name as project_group,project_id,
row_number()over(partition by project_id
order by performance_score desc) as project_group_rank
from performance join projects using(project_id)
where start_date between '2024-01-01' and '2024-06-30'
)
select t.employee_id,employee_name,first_half_2024_score,project_group_rank,department,project_group
from t join employees using(employee_id)
order by project_id,project_group_rank,t.employee_id
查看4道真题和解析