MySQL 풀이 | Find Customer Referee

2025. 1. 17. 13:52·SQL

문제 1.  Find Customer Referee

Table: Customer

+-------------+---------+
| Column Name | Type    |
+-------------+---------+
| id          | int     |
| name        | varchar |
| referee_id  | int     |
+-------------+---------+
In SQL, id is the primary key column for this table.
Each row of this table indicates the id of a customer, their name, and the id of the customer who referred them.
 
Find the names of the customer that are not referred by the customer with id = 2.
Return the result table in any order.
The result format is in the following example.

 

https://leetcode.com/problems/find-customer-referee/description/

 


💡 문제 풀이 

`내 풀이`

SELECT name
FROM Customer
WHERE referee_id <> 2
    OR referee_id is null;
'SQL' 카테고리의 다른 글
  • MySQL 풀이 | Article Views I
  • MySQL 풀이 | Big Countries
  • MySQL 풀이 | 고객이 상품 X 구매 시 상품 Y도 함께 구매할 확률 + 미니 분석
  • MySQL 풀이 | 결제 없이 주문한 사용자 찾기 (난이도 중)
초담
초담
4년차 마케터입니다
  • 초담
    그로스마케터의 기록
    초담
  • 전체
    오늘
    어제
  • 글쓰기 관리
    • 분류 전체보기 (117)
      • Data Analytics Project (3)
      • SQL (55)
      • Python (43)
      • GA4 (0)
      • Tableau (8)
      • 아티클 스터디 (7)
  • 인기 글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.2
초담
MySQL 풀이 | Find Customer Referee
상단으로

티스토리툴바