SELECT ANIMAL_ID, NAME
FROM ANIMAL_INS I JOIN ANIMAL_OUTS O ON I.ANIMAL_ID = O.ANIMAL_ID
WHERE 입양간 기록이 있음
END 보호소에 들어온 기록이 없음
ORDER BY ANIMAL_ID
SELECT O.ANIMAL_ID, O.NAME
FROM ANIMAL_INS I RIGHT JOIN ANIMAL_OUTS O ON I.ANIMAL_ID = O.ANIMAL_ID
WHERE O.DATETIME IS NOT NULL
AND I.DATETIME IS NULL
ORDER BY O.ANIMAL_ID;