Skip to content

Latest commit

 

History

History

0584-Find-Customer-Referee

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
Source : https://leetcode.com/problems/find-customer-referee/
Author : liuyubobobo
Time   : 2022-04-14
Updated: 2022-04-15

Using OR to deal with NULL

SELECT name 
FROM Customer 
WHERE referee_id != 2 OR referee_id IS NULL

Using IFNULL

SELECT name 
FROM Customer 
WHERE IFNULL(referee_id, -1) != 2

Nested Queries

SELECT name 
FROM Customer 
WHERE id NOT IN
(SELECT id FROM Customer WHERE referee_id = 2)