Loading

[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 )
posted @ 2024-09-11 10:14  Duancf  阅读(19)  评论(0)    收藏  举报