Algorithm & SQL/LeetCode
[LeetCode 183번 / MySQL] 183 : Customers Who Never Order
김룹
2024. 3. 10. 13:09
https://leetcode.com/problems/customers-who-never-order/description/
SELECT name AS Customers
FROM customers
LEFT JOIN orders ON customers.id = orders.customerid
WHERE orders.customerid IS NULL
느낀 점 및 정리 ✍️
1. 한 번도 주문하지 않은 고객을 찾기 위해 INNER JOIN이 아닌 OUTER JOIN을 활용했다.
2. customers.id와 orders.customerId로 JOIN 시킨 뒤, Orders의 id가 NULL인 customer의 name을 가져왔다.