File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ Useful for preparing for technical interviews and improving your SQL skills.
34
34
35
35
### Select
36
36
37
+ - [ 584. Find Customer Referee] ( ./leetcode/easy/584.%20Find%20Customer%20Referee.sql )
37
38
- [ 595. Big Countries] ( ./leetcode/easy/595.%20Big%20Countries.sql )
38
39
- [ 1148. Article Views I] ( ./leetcode/easy/1148.%20Article%20Views%20I.sql )
39
40
- [ 1683. Invalid Tweets] ( ./leetcode/easy/1683.%20Invalid%20Tweets.sql )
@@ -112,6 +113,7 @@ Useful for preparing for technical interviews and improving your SQL skills.
112
113
- [ 197. Rising Temperature] ( ./leetcode/easy/197.%20Rising%20Temperature.sql )
113
114
- [ 511. Game Play Analysis 1] ( ./leetcode/easy/511.%20Game%20Play%20Analysis%201.sql )
114
115
- [ 577. Employee Bonus] ( ./leetcode/easy/577.%20Employee%20Bonus.sql )
116
+ - [ 584. Find Customer Referee] ( ./leetcode/easy/584.%20Find%20Customer%20Referee.sql )
115
117
- [ 586. Customer Placing the Largest Number of Orders] ( ./leetcode/easy/586.%20Customer%20Placing%20the%20Largest%20Number%20of%20Orders.sql )
116
118
- [ 595. Big Countries] ( ./leetcode/easy/595.%20Big%20Countries.sql )
117
119
- [ 596. Classes With at Least 5 Students] ( ./leetcode/easy/596.%20Classes%20With%20at%20Least%205%20Students.sql )
Original file line number Diff line number Diff line change
1
+ /*
2
+ Question 584. Find Customer Referee
3
+ Link: https://leetcode.com/problems/find-customer-referee/description/?envType=problem-list-v2&envId=database
4
+
5
+ Table: Customer
6
+
7
+ +-------------+---------+
8
+ | Column Name | Type |
9
+ +-------------+---------+
10
+ | id | int |
11
+ | name | varchar |
12
+ | referee_id | int |
13
+ +-------------+---------+
14
+ In SQL, id is the primary key column for this table.
15
+ Each row of this table indicates the id of a customer, their name, and the id of the customer who referred them.
16
+
17
+
18
+ Find the names of the customer that are not referred by the customer with id = 2.
19
+
20
+ Return the result table in any order.
21
+ */
22
+
23
+ SELECT name
24
+ FROM customer
25
+ WHERE referee_id <> 2 OR referee_id IS NULL
You can’t perform that action at this time.
0 commit comments