题解 | #平均工资#

平均工资

http://www.nowcoder.com/practice/95078e5e1fba4438b85d9f11240bc591

知识点

  1. 排除在职的最大值和最小值就是salary大于最小值和salary小于最大值
  2. where后面不能跟聚合函数,所以需要建立一个子查询

代码

select avg(salary) as 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')
全部评论

相关推荐

03-11 10:06
已编辑
河南师范大学 C++
点赞 评论 收藏
分享
评论
5
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务