알고리즘/프로그래머스
[프로그래머스 SQL] 보호소에서 중성화한 동물
동 코
2020. 4. 18. 02:07
문제풀이
like문을 이용하여 특정 칼럼에 특정 텍스트가 존재하는 지 확인하는 문법을 사용한 문제이다.
소스코드
더보기
1
2
3
4
5
6
7
8
9
|
SELECT a.animal_id,
a.animal_type,
a.name
FROM animal_ins a
LEFT OUTER JOIN animal_outs b
ON a.animal_id = b.animal_id
WHERE a.sex_upon_intake LIKE 'Intact%'
AND ( b.sex_upon_outcome LIKE 'Spayed%'
OR b.sex_upon_outcome LIKE 'Neutered%' );
|
문제 링크 : https://programmers.co.kr/learn/courses/30/lessons/59045