now is better than never
[Level 4][JOIN] 보호소에서 중성화한 동물 본문
https://school.programmers.co.kr/learn/courses/30/lessons/59045
<MySQL>
SELECT ins.animal_id, ins.animal_type, ins.name
from animal_ins ins join animal_outs outs
on ins.animal_id = outs.animal_id
where ins.sex_upon_intake != outs.sex_upon_outcome
정석으로 풀면
SELECT ins.animal_id, ins.animal_type, ins.name
from animal_ins ins join animal_outs outs
on ins.animal_id = outs.animal_id
where ins.sex_upon_intake LIKE 'Intact%' and
(outs.sex_upon_outcome LIKE 'Spayed%' or
outs.sex_upon_outcome LIKE 'Neutered%')
이겠지만 중성화하면 상태명,,?이 달라질테니까 귀찮아서 저렇게 풂.
'프로그래머스 > SQL' 카테고리의 다른 글
[LEVEL 2][String, Date] 자동차 평균 대여 기간 구하기 (0) | 2023.05.15 |
---|---|
[Level 4][SELECT] 서울에 위치한 식당 목록 출력하기 (0) | 2023.01.04 |
[Level 2][SELECT] 3월에 태어난 여성 회원 목록 출력하기 (SQL 날짜 월 출력) (0) | 2023.01.03 |
[Level 4][GROUP BY] 저자 별 카테고리 별 매출액 집계하기 (0) | 2023.01.03 |
[Level 4][GROUP BY] 입양시각 구하기 (2) ([Oracle] 0에서 23 까지 숫자 생성) (0) | 2023.01.03 |