Skip to content

Commit a22b9e7

Browse files
authored
Create sales-analysis-ii.sql
1 parent 3adae53 commit a22b9e7

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

MySQL/sales-analysis-ii.sql

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Time: O(m + n)
2+
# Space: O(m + n)
3+
4+
SELECT DISTINCT buyer_id
5+
FROM sales
6+
INNER JOIN product
7+
ON sales.product_id = product.product_id
8+
WHERE product.product_name = "s8"
9+
AND buyer_id NOT IN (SELECT DISTINCT buyer_id
10+
FROM sales
11+
INNER JOIN product
12+
ON sales.product_id = product.product_id
13+
WHERE product.product_name = "iphone");

0 commit comments

Comments
 (0)