题解 | #获取当前薪水第二多的员工的emp_no以及其对应的薪水salary#
获取当前薪水第二多的员工的emp_no以及其对应的薪水salary
http://www.nowcoder.com/practice/8d2c290cc4e24403b98ca82ce45d04db
解题思路1:
SELECT emp_no,salary from salaries
where to_date='9999-01-01'
order by salary DESC LIMIT 1,1
解题思路2:
SELECT emp_no,salary from
(
SELECT emp_no,salary,ROW_NUMBER() over(order by salary desc) t
FROM salaries
WHERE to_date='9999-01-01'
) as new
where new.t=2
