182. 查找重复的电子邮箱
select email from person group by email having count(email)>1
196. 删除重复的电子邮箱
delete a from
Person a left join Person b
on a.email = b.email
where a.id > b.id
delete from Person where id not in(
select a.id from
(select min(id) as id from Person group by email) a
)
delete from Person where id in
(
select id from
(
select a.id from Person a left join Person b on a.email = b.email where a.id > b.id
) as temp
)
176. 第二高的薪水
select ifnull
(
(select salary
from Employee
order by salary desc
limit 1,1),null
) as SecondHighestSalary
596. 超过5名学生的课
select class from courses group by class having count(*) >= 5
595. 大的国家
select name,population,area from world where area >= 3000000 or population >= 25000000