SQL 54) 排除最大、最小salary之后的当前员工的平均工资
查找排除当前最大、最小salary之后的员工的平均工资avg_salary
http://www.nowcoder.com/questionTerminal/95078e5e1fba4438b85d9f11240bc591
方法)NOT IN
SELECT AVG(salary) FROM salaries WHERE salary NOT IN( SELECT MAX(salary) FROM salaries WHERE to_date = '9999-01-01') AND salary NOT IN ( SELECT MIN(salary) FROM salaries WHERE to_date = '9999-01-01') AND to_date = '9999-01-01';用NOT IN + 子查询筛选排除掉最大值和最小值
SQL 文章被收录于专栏
SQL