https://programmers.co.kr/learn/courses/30/lessons/59039
SELECT ANIMAL_ID
FROM ANIMAL_INS
WHERE NAME IS NULL
ORDER BY 1
https://programmers.co.kr/learn/courses/30/lessons/59407
SELECT ANIMAL_ID
FROM ANIMAL_INS
WHERE NAME IS NOT NULL
ORDER BY 1
https://programmers.co.kr/learn/courses/30/lessons/59410
SELECT ANIMAL_TYPE,
CASE WHEN NAME IS NULL THEN 'No name'
ELSE NAME END AS NAME, SEX_UPON_INTAKE
FROM ANIMAL_INS
https://programmers.co.kr/learn/courses/30/lessons/59042
SELECT AO.ANIMAL_ID ANIMAL_ID, AO.NAME
FROM ANIMAL_INS AI
RIGHT JOIN ANIMAL_OUTS AO ON AI.ANIMAL_ID = AO.ANIMAL_ID
WHERE AI.ANIMAL_ID IS NULL
https://programmers.co.kr/learn/courses/30/lessons/59043
SELECT AO.ANIMAL_ID ANIMAL_ID, AO.NAME
FROM ANIMAL_INS AI
JOIN ANIMAL_OUTS AO ON AI.ANIMAL_ID = AO.ANIMAL_ID
WHERE AI.DATETIME > AO.DATETIME
ORDER BY AI.DATETIME
https://programmers.co.kr/learn/courses/30/lessons/59044
SELECT AI.NAME, AI.DATETIME
FROM ANIMAL_INS AI
LEFT JOIN ANIMAL_OUTS AO ON AI.ANIMAL_ID = AO.ANIMAL_ID
WHERE AO.DATETIME IS NULL
ORDER BY DATETIME
LIMIT 3
https://programmers.co.kr/learn/courses/30/lessons/59045
SELECT AI.ANIMAL_ID, AI.ANIMAL_TYPE, AI.NAME
FROM ANIMAL_INS AI
JOIN ANIMAL_OUTS AO ON AI.ANIMAL_ID = AO.ANIMAL_ID
WHERE AO.SEX_UPON_OUTCOME <> AI.SEX_UPON_INTAKE
ORDER BY AI.ANIMAL_ID