文章目录
前面的内容已经把数据库的一些必要知识已经储备好了,因此下面就对于这些语句进行一些练习:
批量插入数据
insert into actor values
(1, 'PENELOPE', 'GUINESS', '2006-02-15 12:34:33'),
(2, 'NICK', 'WAHLBERG', '2006-02-15 12:34:33');
SQL202 找出所有员工当前薪水salary情况
select distinct salary from salaries order by salary desc;
SQL195 查找最晚入职员工的所有信息
select * from employees order by hire_date desc limit 1;
SQL196 查找入职员工时间排名倒数第三的员工所有信息
select * from employees where hire_date=
(select distinct hire_date from employees order by hire_date desc limit 2, 1);
SQL201 查找薪水记录超过15条的员工号emp_no以及其对应的记录次数t
select emp_no, count(emp_no) as t from salaries group by emp_no having t > 15;
182. 查找重复的电子邮箱
select email as Email from Person group by Email having count(Email) > 1;
595. 大的国家
select name, population, area from World where population>=25000000 || area >= 3000000;