1045. 买下所有产品的客户 难度:中等

1、题目描述

在这里插入图片描述
在这里插入图片描述
来源:力扣(LeetCode)

2、解题思路

1# 首先对Customer去重,select distinct * from customer
2# 然后,统计每个客人购买的货物种类数量select customer_id,count(product_key) cou1
3# 增加子表,对Product统计所有货物种类select count(*) as cou2 from Product
4# 对比两个量

3、提交记录

select customer_id
from

(select customer_id,count(product_key) cou1
from (select distinct * from customer)a3
group by customer_id) a,

(select count(*) as cou2
from Product)b
    
where a.cou1=b.cou2
发布了90 篇原创文章 · 获赞 3 · 访问量 4942

猜你喜欢

转载自blog.csdn.net/weixin_43329319/article/details/97613114