题解 | SQL211
获取当前薪水第二多的员工的emp_no以及其对应的薪水salary
https://www.nowcoder.com/practice/8d2c290cc4e24403b98ca82ce45d04db
select emp_no ,salary from salaries where salary =(SELECT DISTINCT salary FROM salaries order by salary desc limit 1,1 /*查出第二多工资具体数值*/) order by emp_no /*where +子查询*/ select AA.emp_no ,AA.salary from (select emp_no ,salary ,dense_rank()over(order by salary desc) as ra from salaries) as AA where AA.ra=2 --from+子查询