1创建一个员工表
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`));
2插入数据
insert into employees values(10007,1995-02-18,'ge','yao','M',1998-09-18);
insert into employees values(10008,'1948-02-18','ge','ao','M','1997-09-18');
insert into employees values(10009,'1946-12-18','rge','ao','M','2017-09-18');
3 [编程题]查找最晚入职员工的所有信息
select * from employees
where hire_date =
(select max(hire_date) from employees)
4插入数据
insert into employees values(10011,'1988-01-18','yao','aro','M','1999-07-18');
insert into employees values(10012,'1976-12-18','wang','ao','W','2017-01-18');
insert into employees values(10010,'1945-01-18','yao','aro','W','1999-07-18');
5查找入职员工时间排名倒数第三的员工所有信息
select * from employees
where hire_date = (
select distinct hire_date from employees order by hire_date desc limit 2,1
)