Skip to content

Commit 48f0391

Browse files
committed
Upload 123
1 parent 3c510f8 commit 48f0391

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ To make the daily tasks of creating a new file and updating the index easier, th
151151
| 120 | [Classes More Than 5 Students](https://leetcode.com/problems/classes-more-than-5-students/description/) | [Solution](solutions/120_classes_more_than_5_students.md) | LeetCode | Easy | |
152152
| 121 | [Find Followers Count](https://leetcode.com/problems/find-followers-count/description/) | [Solution](solutions/121_find_followers_count.md) | LeetCode | Easy | |
153153
| 122 | [Biggest Single Number](https://leetcode.com/problems/biggest-single-number/description/) | [Solution](solutions/122_biggest_single_number.md) | LeetCode | Easy | |
154+
| 123 | [Customers Who Bought All Products](https://leetcode.com/problems/customers-who-bought-all-products/description/) | [Solution](solutions/123_customers_who_bought_all_products.md) | LeetCode | Medium | |
154155

155156
## Author(s)
156157

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# SQL Everyday \#123
2+
3+
## Customers Who Bought All Products
4+
5+
Site: LeetCode\
6+
Difficulty per Site: Medium
7+
8+
## Problem
9+
10+
Write a solution to report the customer ids from the `Customer` table that bought all the products in the `Product` table.
11+
12+
Return the result table in *any order*. [[Full Description](https://leetcode.com/problems/customers-who-bought-all-products/description/)]
13+
14+
## Submitted Solution
15+
16+
```sql
17+
-- Submitted Solution
18+
SELECT
19+
customer_id
20+
FROM Customer
21+
GROUP BY customer_id
22+
HAVING COUNT(DISTINCT product_key) = (SELECT COUNT(product_key) FROM Product)
23+
;
24+
```
25+
26+
## Site Solution
27+
28+
```sql
29+
-- LeetCode Solution
30+
-- Site solution essentially the same.
31+
```
32+
33+
## Notes
34+
35+
TODO
36+
37+
Go to [Table of Contents](/README.md#contents)\
38+
Go to [Overview](/README.md)

0 commit comments

Comments
 (0)