Skip to content

Commit 01f317f

Browse files
committed
task: #584
1 parent d5ca081 commit 01f317f

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Useful for preparing for technical interviews and improving your SQL skills.
3434

3535
### Select
3636

37+
- [584. Find Customer Referee](./leetcode/easy/584.%20Find%20Customer%20Referee.sql)
3738
- [595. Big Countries](./leetcode/easy/595.%20Big%20Countries.sql)
3839
- [1148. Article Views I](./leetcode/easy/1148.%20Article%20Views%20I.sql)
3940
- [1683. Invalid Tweets](./leetcode/easy/1683.%20Invalid%20Tweets.sql)
@@ -112,6 +113,7 @@ Useful for preparing for technical interviews and improving your SQL skills.
112113
- [197. Rising Temperature](./leetcode/easy/197.%20Rising%20Temperature.sql)
113114
- [511. Game Play Analysis 1](./leetcode/easy/511.%20Game%20Play%20Analysis%201.sql)
114115
- [577. Employee Bonus](./leetcode/easy/577.%20Employee%20Bonus.sql)
116+
- [584. Find Customer Referee](./leetcode/easy/584.%20Find%20Customer%20Referee.sql)
115117
- [586. Customer Placing the Largest Number of Orders](./leetcode/easy/586.%20Customer%20Placing%20the%20Largest%20Number%20of%20Orders.sql)
116118
- [595. Big Countries](./leetcode/easy/595.%20Big%20Countries.sql)
117119
- [596. Classes With at Least 5 Students](./leetcode/easy/596.%20Classes%20With%20at%20Least%205%20Students.sql)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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

0 commit comments

Comments
 (0)