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

描述

有一个薪水表,salaries简况如下:

 

 请你找出所有员工具体的薪水salary情况,对于相同的薪水只显示一次,并按照逆序显示,以上例子输出如下:

 

 找出所有员工当前(to_date=‘9999-01-01’)具体的薪水salary情况,对于相同的薪水只显示一次,并按照逆序显示

方法1:

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

方法2:

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

  

posted @ 2021-10-01 13:46  杜嘟嘟  阅读(65)  评论(0编辑  收藏  举报