LeetCode - 607. Sales Person (MySQL)

조민수·2024년 6월 11일
0

LeetCode

목록 보기
30/64
post-custom-banner

Easy, SQL - LEFT JOIN

RunTime : 1349 ms


문제

Write a solution to find the names of all the salespersons who did not have any orders related to the company with the name "RED".

Return the result table in any order.

The result format is in the following example.


풀이

  • 서브쿼리를 작성하면서 좀 생각을 요했던 문제
  • 프로그래머스 Lv3 정도 되는 듯
SELECT S.name FROM SalesPerson as S
WHERE S.sales_id NOT IN (
    SELECT O.sales_id FROM Orders as O LEFT JOIN Company as C
    ON O.com_id = C.com_id WHERE C.name = 'RED'
)
profile
사람을 좋아하는 Front-End 개발자
post-custom-banner

0개의 댓글