[Leetcode] 183. Customers Who Never Order (MySQL)

마이구미·2021년 12월 6일
0

PS

목록 보기
55/69
post-thumbnail

문제

183. Customers Who Never Order

코드

select customers.name as Customers
from customers
where customers.id not in 
(
    select customerid from orders
)

접근

단순히 주문 테이블의 customerId가 고객 테이블의 id에 존재하지 않는다면 이는 주문하지 않은 것을 의미하므로 서브쿼리와 not in 을 이용해서 처리했다.

profile
마이구미 마시쪙

0개의 댓글