LeetCode solutions

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

Read the problem on LeetCode View on GitHub

SQL

Accepted on LeetCode — runtime 489ms, memory 0.0B, accepted 2025-12-29.

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

Source