SELECT * FROM employees ORDER by hire_date desc limit 1 OFFSET 2
其他网友题解思路: select * from employees where hire_date= (select min(a.hire_date) from employees a,employees b where a.emp_no!=b.emp_no and a.hire_date<b.hire_date group by a.emp_no having count(*)<3)
另一位网友EricZeng写法: SELECT emp_no, birth_date, first_name, last_name, gender, hire_date FROM employees WHERE hire_date=( SELECT DISTINCT hire_date FROM employees ORDER BY hire_date DESC LIMIT 2,1) 另外根据阿里巴巴Java开发规范v1.4中,数据库规约,关键词应大写,SELECT后面不要跟着“*”,要把具体的字段写出来。
大神牛客471398820号用窗口函数写法: SELECT a.emp_no, a.birth_date, a.first_name, a.last_name, a.gender, a.hire_date FROM (SELECT emp_no, birth_date, first_name, last_name, gender, hire_date, DENSE_RANK() OVER(ORDER BY hire_date DESC) AS rk FROM employees) AS a WHERE a.rk = 3;