보호소에서 중성화한 동물
https://school.programmers.co.kr/learn/courses/30/lessons/59045
- 문제 풀이
1
2
3
4
5
6
7
8
SELECT I.ANIMAL_ID, I.ANIMAL_TYPE, I.NAME
FROM ANIMAL_INS I
JOIN ANIMAL_OUTS O
ON I.ANIMAL_ID = O.ANIMAL_ID
WHERE 1=1
AND I.SEX_UPON_INTAKE LIKE 'Intact%'
AND(O.SEX_UPON_OUTCOME LIKE 'Spayed%' OR O.SEX_UPON_OUTCOME LIKE 'Neutered%')
ORDER BY I.ANIMAL_ID;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
SELECT
I.ANIMAL_ID,
I.ANIMAL_TYPE,
I.NAME
FROM
ANIMAL_INS I
INNER JOIN
ANIMAL_OUTS O
ON
I.ANIMAL_ID = O.ANIMAL_ID
WHERE
I.SEX_UPON_INTAKE LIKE 'Intact%'
AND (O.SEX_UPON_OUTCOME LIKE 'Spayed%' OR O.SEX_UPON_OUTCOME LIKE 'Neutered%')
ORDER BY
ANIMAL_ID;
- 실행 결과
이 기사는 저작권자의 CC BY 4.0 라이센스를 따릅니다.