#76. [LeetCode / MySQL] 584. Find Customer Referee

문제

 

입력 코드

1. 

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

 

2. 

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

 

코드 설명

#SELECT #NULL #NOT IN #SUBQUERY

 

 

문제 출처

 

Find Customer Referee - LeetCode

Can you solve this real interview question? Find Customer Referee - Table: Customer +-------------+---------+ | Column Name | Type | +-------------+---------+ | id | int | | name | varchar | | referee_id | int | +-------------+---------+ In SQL, id is the

leetcode.com