select * from employees where hire_date = (
select distinct hire_date from employees order by hire_date desc limit 1 offset 2)
此题的题面是否存在漏洞,不同的理解会有不同的结果,如果按照时间排序,有两个并列第一之后,下一个就是第三名,即用窗口函数实现会报错,如:
select a.emp_no, a.birth_date, a.first_name, a.last_name, a.gender, a.hire_date
from (
select *, rank() over (order by hire_date desc) rank from employees) a
where a.rank = 3