코테/프로그래머스

이름에 el이 들어가는 동물 찾기

밍래그로프 2020. 12. 30. 16:21

mysql로 할 때

SELECT animal_id, name FROM animal_ins WHERE animal_type="dog" 

AND name LIKE "%EL%" ORDER BY name

 

oracle 로 할 때

SELECT animal_id, name FROM animal_ins WHERE animal_type='Dog'
AND UPPER(name) LIKE '%EL%' ORDER BY name

 

upper를 안쓰면 안된다. 대소문자를 구분하기 때문이다.

그래서 animal_type 도 dog 라고 하면 안된다.

또 주의할 점이 문자열이라고 해도 오라클에서는 "" 을 취급하지 않는다. 

mysql과 호환이 안될 수도 있다.