题目描述:查找排除最大、最小salary之后的当前(to_date = '9999-01-01' )员工的平均工资avg_salary。

select avg(salary)
from salaries
where to_date="9999-01-01"
and salary != (select max(salary) from salaries where to_date="9999-01-01")
and salary != (select min(salary) from salaries where to_date="9999-01-01")

关于为什么要用多个where子句判断to_date="9999-01-01".
题目描述查找排除最大、最小salary之后的当前(to_date = '9999-01-01' )员工的平均工资avg_salary。
个人思路先找出当前在职员工的最大、最小薪水。然后在当前在职员工薪水集合里扣除再求均值。