SQL_202

找出所有员工当前薪水salary情况

https://www.nowcoder.com/practice/ae51e6d057c94f6d891735a48d1c2397

方法一:

思路:对工资去重,降序

代码:

select distinct salary from salaries where to_date='9999-01-01' order by salary desc

方法二:

思路:用 group By 去重对工资去重,再降序。 group by 去重的性能高于 distinct

代码:

select salary from salaries where to_date='9999-01-01' group by salary order by salary desc;

全部评论

相关推荐

06-05 19:46
已编辑
武汉大学 后端
点赞 评论 收藏
分享
每晚夜里独自颤抖:这个在牛客不是老熟人了吗
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
07-02 18:35
简历上把1个月实习写成了3个月,会进行背调吗?
码农索隆:一个月有一个月的实习经历,三个月有三个月的实习经历
点赞 评论 收藏
分享
评论
5
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务