终于开始刷sql题啦~每天10道,开始开始~
day1 2.22 先来5题练手~
题目:查找最晚入职员工的所有信息
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
));
Answer:
select * from employees
where hire_date=(select max(hire_date) from employees)
思路:利用max函数将最大hire_date找到再select对应信息,傻瓜办法
附链接:[link]https://www.nowcoder.com/practice/218ae58dfdcd4af195fff264e062138f?tpId=82&tqId=29753&rp=0&ru=/ta/sql&qru=/ta/sql/question-ranking