1135. Customers Who Bought All Products
My accepted SQL solution to LeetCode problem 1135, Customers Who Bought All Products, running in 489ms.
- Difficulty: Medium
- SQL
- Runtime 489ms
- Memory 0.0B
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
SQL
Accepted on LeetCode — runtime 489ms, memory 0.0B, accepted 2025-12-29.
SELECT customer_id
FROM Customer
GROUP BY customer_id
HAVING COUNT(DISTINCT product_key) = (SELECT COUNT(*) FROM Product)