题解 | #平均工资#
平均工资
http://www.nowcoder.com/practice/95078e5e1fba4438b85d9f11240bc591
-- 此题要注意在职员工,在查询最大值最小值时也需要是在在职员工中查找。
with a AS
(select *
from salaries
where to_date = '9999-01-01' )
select AVG(salary) avg_salary
FROM a
where salary != (select max(salary) from a)
and salary != (select min(salary) from a)

