找出所有员工当前薪水情况,对于相同薪水只显示一次,并按照逆序显示
找出所有员工当前薪水salary情况
http://www.nowcoder.com/questionTerminal/ae51e6d057c94f6d891735a48d1c2397
1.常规解法,使用DISTINCT和ORDER BY:
SELECT DISTINCT salary FROM salaries WHERE to_date='9999-01-01' ORDER BY salary DESC
2.也可以使用GROUP BY :
按照salary进行分组
SELECT salary FROM salaries WHERE to_date='9999-01-01' GROUP BY salary ORDER BY salary DESC