题目:获取当前(to_date=‘9999-01-01’)薪水第二多的员工的emp_no以及其对应的薪水salary
子查询+DISTINCT
SELECT emp_no, salary
FROM salaries
WHERE to_date = '9999-01-01'
AND salary = (SELECT DISTINCT salary FROM salaries ORDER BY salary desc limit 1 offset 1);
子查询+GROUP BY
SELECT emp_no, salary
FROM salaries
WHERE to_date = '9999-01-01'
AND salary = (SELECT salary FROM salaries GROUP BY salary ORDER BY salary desc limit 1 offset 1);