#103. [LeetCode / MySQL] 1045. Customers Who Bought All Products

문제

 

입력 코드

SELECT customer_id
FROM Customer
GROUP BY customer_id
HAVING COUNT(DISTINCT(product_key)) = (SELECT COUNT(product_key) FROM Product);

 

코드 설명

#SELECT #GROUP BY #HAVING #COUNT #DISTINCT

 

 

문제 출처

 

LeetCode - The World's Leading Online Programming Learning Platform

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

leetcode.com