题解 | 统计各个部门平均薪资
统计各个部门平均薪资
https://www.nowcoder.com/practice/4722fdf89a4c43eebb58d61a19ccab31
select
department
,round(avg(t2.ts),3) as avg_salary
from staff_tb t1
right join (select
*
,(normal_salary - dock_salary) as ts
from salary_tb
where (normal_salary - dock_salary) between 4000 and 30000
)t2
on t1.staff_id = t2.staff_id
group by 1
order by 2 desc
where 语句中不能出现新设置的列名称
查看6道真题和解析
OPPO公司福利 1229人发布