[SQL手撕]
删除重复的电子邮箱
delete from Person
where id not in
(select id from
(select min(id) as id from Person
group by email) as temp)
好友申请 II :谁有最多的好友
select id,count(id) as num from
(select requester_id as id from RequestAccepted
union all
select accepter_id as id from RequestAccepted) as temp
group by id
order by num desc
limit 1
买下所有产品的客户
select customer_id from Customer
group by customer_id
having count(distinct product_key) = (select count(product_key ) from Product )