728x90

Orders 테이블에서 실제로 주문한 고객ID인 customerId 가 존재한다. 이때 Customer 테이블에 있는 고객 중 실제로 구매하지 않은 사람의 name을 반환하는 SQL을 작성하면 된다.
(여기서 핵심은 not in 연산자를 사용하는 것이다.)
select name as Customers
from Customers
where id not in (
select customerId
from Orders
)
반응형
'데이터베이스 > SQL' 카테고리의 다른 글
627. Swap Salary (0) | 2022.12.03 |
---|---|
1873. Calculate Special Bonus (0) | 2022.12.03 |
584. Find Customer Referee (0) | 2022.11.30 |
1757. Recyclable and Low Fat Products (1) | 2022.11.30 |
595. Big Countries (0) | 2022.11.30 |