Practice Find Customer Referee
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Tables: Customer(id INT, name VARCHAR, referee_id INT). Customer.id is unique. referee_id identifies the customer who made the referral and may be null. Return names of customers whose referee_id is not 2, including customers with no referee. Output order is unrestricted; a plain inequality alone omits null values in SQL.
Source: Find Customer Referee on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
Customer table: +----+------+------------+ | id | name | referee_id | +----+------+------------+ | 1 | Will | null | | 2 | Jane | null | | 3 | Alex | 2 | | 4 | Bill | null | | 5 | Zack | 1 | | 6 | Mark | 2 | +----+------+------------+
Output
+------+ | name | +------+ | Will | | Jane | | Bill | | Zack | +------+
Related LeetCode Problems
Practice more problems similar to Find Customer Referee.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.