-- https://school.programmers.co.kr/learn/courses/30/lessons/59046
SELECT animal_id, name, sex_upon_intake
from animal_ins
where name in ('Lucy', 'Ella', 'Pickle', 'Rogan', 'Sabrina', 'Mitty')
order by animal_id
-- https://school.programmers.co.kr/learn/courses/30/lessons/59047
SELECT animal_id, name
from animal_ins
where animal_type='dog' and name like '%el%'
order by name
-- https://school.programmers.co.kr/learn/courses/30/lessons/59409
-- if
SELECT animal_id,
name,
if (sex_upon_intake like '%Spayed%'or sex_upon_intake like'%Neutered%','O','X') as '중성화'
from animal_ins
order by animal_id
-- case when
SELECT animal_id,
name,
(case
when sex_upon_intake like '%Spayed%'or sex_upon_intake like'%Neutered%' then 'O'
else 'X'
end) as '중성화'
from animal_ins
order by animal_id
-- regex
SELECT ANIMAL_ID,
NAME,
(CASE
WHEN SEX_UPON_INTAKE REGEXP 'Neutered|Spayed' THEN 'O' ELSE 'X'
END) AS 중성화
FROM ANIMAL_INS
ORDER BY ANIMAL_ID
헐 칼럼 이름 붙일 때 '따옴표 안써도 된다..' 허걱..스..스.슷.ㅡㅅ.ㅡ...