카테고리 없음
[프로그래머스/mysql] level3 없어진 기록 찾기
born-A
2023. 4. 17. 21:21
문제
개념
LEFT JOIN 시 전체 테이블 조회
오른쪽 테이블의 경우, ANIMAL_ID가 왼쪽 ANIMAL_ID와 같만 들어간다.
출처 : https://stackoverflow.com/questions/53949197/isnt-sql-a-left-join-b-just-a/53949327
Isn't SQL A left join B, just A?
So I was looking at a few graphs to understand the difference between the joins, and I came across this image: Maybe the problem is in representing this with Venn Diagrams. But looking at the firs...
stackoverflow.com
코드
SELECT outs.animal_id AS ANIMAL_ID, outs.name AS NAME
FROM animal_outs AS outs
LEFT JOIN animal_ins AS ins
ON outs.animal_id = ins.animal_id
WHERE
ins.animal_id IS NULL;
참고 블로그
프로그래머스 - SQL SELECT 없어진 기록 찾기
프로그래머스 - SQL SELECT 없어진 기록 찾기. 천재지변으로 인해 일부 데이터가 유실되었습니다. 입양을 간 기록은 있는데, 보호소에 들어온 기록이 없는 동물의 ID와 이름을 ID 순으로 조회하는 SQL
velog.io