코딩테스트/리트코드 SQL
[리트코드/SQL] 19. Sales Person (607)
Sooyoon Jeong
2022. 12. 18. 16:50
🤔 문제 분석
1) Write an SQL query to report the names of all the salespersons who did not have any orders related to the company with the name "RED".
2) Return the result table in any order.
💡 풀이
SELECT name
FROM salesperson
WHERE sales_id not in (SELECT sales_id
FROM orders
WHERE com_id = (SELECT com_id
FROM company
WHERE name = "Red"))