题目描述
查找入职员工时间排名倒数第三的员工所有信息
CREATE TABLE `employees` (
`emp_no` int(11) NOT NULL,
`birth_date` date NOT NULL,
`first_name` varchar(14) NOT NULL,
`last_name` varchar(16) NOT NULL,
`gender` char(1) NOT NULL,
`hire_date` date NOT NULL,
PRIMARY KEY (`emp_no`));
错误用法:select * from employees order by hire_date desc limit 2,1;
limit m,n:表示从第m+1条数据开始,取n条数据
limit n:即limit 0,n 从第一条数据开始,取n条数据
正确答案:
select * from employees order by hire_date desc limit 2,1;