【MySQL篇】基本查询实战OJ
本篇是基于上篇mysql基本查询的一些OJ题
MySQL基本查询传送门:【MySQL篇】MySQL基本查询详解-CSDN博客
批量插入数据_牛客题霸_牛客网
insert语句
insert into actor values (1,'PENELOPE','GUINESS','2006-02-15 12:34:33');
insert into actor values (2,'NICK','WAHLBERG','2006-02-15 12:34:33');
找出所有员工当前薪水salary情况_牛客题霸_牛客网
distinct去重+order by 排序
select distinct salary from salaries order by salary desc;
查找最晚入职员工的所有信息_牛客题霸_牛客网
select * from employees order by hire_date desc limit 1;
查找入职员工时间升序排名的情况下的倒数第三的员工所有信息_牛客题霸_牛客网
select * from employees where hire_date=(select distinct hire_date from employees
order by hire_date desc limit 1 offset 2);
查找薪水记录超过15条的员工号emp_no以及其对应的记录次_牛客题霸_牛客网
group by子句及聚合函数
select emp_no,count(emp_no) as t from salaries group by emp_no having t>15;
182. 查找重复的电子邮箱 - 力扣(LeetCode)
group by子句+聚合函数
select Email from Person group by Email having count(Email)>1;
595. 大的国家 - 力扣(LeetCode)
where子句
select name,population,area from World where area>=3000000 or population>=25000000;