https://programmers.co.kr/learn/courses/30/lessons/59045
보호소에서 중성화 수술을 거친 동물 정보를 알아보려 합니다. 보호소에 들어올 당시에는 중성화1되지 않았지만, 보호소를 나갈 당시에는 중성화된 동물의 아이디와 생물 종, 이름을 조회하는 아이디 순으로 조회하는 SQL 문을 작성해주세요.
** 중성화를 거치지 않은 동물은 성별 및 중성화 여부에 Intact, 중성화를 거친 동물은 Spayed 또는 Neutered라고 표시되어있습니다.
-- 코드를 입력하세요
SELECT o.animal_id, o.animal_type, o.name
from animal_ins i, animal_outs o
where i.animal_id = o.animal_id
and i.sex_upon_intake like 'Intact%'
and (o.sex_upon_outcome like 'Spayed%'
or o.sex_upon_outcome like 'Neutered%')
order by 1
animal_id animal_type name
A382192 Dog Maxwell 2
A410330 Dog Chewy
'IT > SQLD' 카테고리의 다른 글
[프로그래머스][Oracle] 이름에 el이 들어가는 동물 찾기(String, Date) (0) | 2021.10.04 |
---|---|
[프로그래머스][Oracle] 루시와 엘라 찾기(String,Date) (0) | 2021.10.04 |
[프로그래머스][Oracle] 오랜 기간 보호한 동물(1) (JOIN)* (0) | 2021.10.04 |
[프로그래머스][Oracle] 있었는데요 없었습니다.(JOIN) (0) | 2021.10.04 |
[프로그래머스][Oracle] 없어진 기록 찾기 (JOIN)* (0) | 2021.10.04 |