문제) Leetcode - Join - Customers Who Never Order
https://leetcode.com/problems/customers-who-never-order/
Customers Who Never Order - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com
customer 테이블에서 order 테이블에 존재하지 않는 name을 찾는 문제였습니다. customer 테이블과 order 테이블을 left join 한 후에 where문으로 order에 존재하지 않는 사람을 찾으면 해결할 수 있습니다.
풀이)
select a.name as Customers
from Customers as a left join Orders as b on a.id = b.customerId
where b.id is null
반응형
'Develop > Database' 카테고리의 다른 글
[프로그래머스] SQL 고득점 Kit - 이름에 el이 들어가는 동물 찾기 (MySQL) 문제 및 풀이 (0) | 2021.12.20 |
---|---|
[프로그래머스] SQL 고득점 Kit - 입양 시각 구하기(1) (MySQL) 문제 및 풀이 (0) | 2021.12.19 |
[프로그래머스] SQL 고득점 Kit - 오랜 기간 보호한 동물(1) (MySQL) 문제 및 풀이 (0) | 2021.12.13 |
[프로그래머스] SQL 고득점 Kit - 있었는데요 없었습니다 (MySQL) 문제 및 풀이 (0) | 2021.12.12 |
[프로그래머스] SQL 고득점 Kit - 없어진 기록 찾기 (MySQL) 문제 및 풀이 (0) | 2021.12.12 |
댓글