select avg(salary) avg_salary
from salaries
where 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')
and to_date='9999-01-01'

思路:最重要的一个条件就是在排除最高薪水和最低薪水时要加上 to_date='9999-01-01',题目并没有说清楚。