Find Customer Referee

You can retrieve the names of the customers who were not referred by the customer with id = 2 by using a simple SELECT query with a WHERE clause. Here’s the query:

1
2
3
SELECT name
FROM Customer
WHERE referee_id <> 2 OR referee_id IS NULL;

Explanation:

  • The WHERE clause filters the rows where referee_id is not equal to 2 or is null.
  • It will return the names of the customers that meet these conditions.