Find Customer Referee
Preview mode. Log in to edit, run, submit, and save progress.
Medium
Find Customer Referee
You have a Customer table where each customer may have been referred by another customer (stored as referee_id). Write a SQL query to find the names of customers who were NOT referred by the customer with id = 2. Return the result in any order.
Examples
Example 1
Alex and Mark were referred by customer 2. All others (including those with NULL referee_id) are returned.
Approach hint
Start with a simple approach, explain the trade-off, then move toward a cleaner or more scalable solution.
Common mistake
Skipping assumptions, edge cases, or trade-offs can make an otherwise good answer feel incomplete.
query.sql