Skip to content

task: #584 #76

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Useful for preparing for technical interviews and improving your SQL skills.

### Select

- [584. Find Customer Referee](./leetcode/easy/584.%20Find%20Customer%20Referee.sql)
- [595. Big Countries](./leetcode/easy/595.%20Big%20Countries.sql)
- [1148. Article Views I](./leetcode/easy/1148.%20Article%20Views%20I.sql)
- [1683. Invalid Tweets](./leetcode/easy/1683.%20Invalid%20Tweets.sql)
Expand Down Expand Up @@ -112,6 +113,7 @@ Useful for preparing for technical interviews and improving your SQL skills.
- [197. Rising Temperature](./leetcode/easy/197.%20Rising%20Temperature.sql)
- [511. Game Play Analysis 1](./leetcode/easy/511.%20Game%20Play%20Analysis%201.sql)
- [577. Employee Bonus](./leetcode/easy/577.%20Employee%20Bonus.sql)
- [584. Find Customer Referee](./leetcode/easy/584.%20Find%20Customer%20Referee.sql)
- [586. Customer Placing the Largest Number of Orders](./leetcode/easy/586.%20Customer%20Placing%20the%20Largest%20Number%20of%20Orders.sql)
- [595. Big Countries](./leetcode/easy/595.%20Big%20Countries.sql)
- [596. Classes With at Least 5 Students](./leetcode/easy/596.%20Classes%20With%20at%20Least%205%20Students.sql)
Expand Down
25 changes: 25 additions & 0 deletions leetcode/easy/584. Find Customer Referee.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
Question 584. Find Customer Referee
Link: https://leetcode.com/problems/find-customer-referee/description/?envType=problem-list-v2&envId=database

Table: Customer

+-------------+---------+
| Column Name | Type |
+-------------+---------+
| id | int |
| name | varchar |
| referee_id | int |
+-------------+---------+
In SQL, id is the primary key column for this table.
Each row of this table indicates the id of a customer, their name, and the id of the customer who referred them.


Find the names of the customer that are not referred by the customer with id = 2.

Return the result table in any order.
*/

SELECT name
FROM customer
WHERE referee_id <> 2 OR referee_id IS NULL