我有三个表,我提出的相同SQL查询负
精简版本CUSTOMER_DIM
[Cust_id] [Cust_Name]
PRODUCT_DIM
[Prod_id] [Prod_Name]
Orders_fact
[ord_id] [Cust_id] [Prod_id]
我想谁买的每一件产品(甚至不是一个单一的一个缺失)
我想不是简单地等同每个客户群的数量与prod_dim
即我不想以下类型的查询(因为它是一个面试问题和还有点高雅也)
select cust_name
from customers c,
(select cust_id, count(prod_id) cnt
from order_fact
group by cust_id where cnt = (select count(prod_id) from prod_dim)) t1
where c.cust_id = t1.cust_id