kunkunwoo@blog:~$ 거누권의 생각깜지

프로그래머스 고득점 키트 _ IS NULL_MYSQL

· 배운 것 · 1분 읽기

https://programmers.co.kr/learn/courses/30/parts/17045

프로그래머스

1. 이름이 없는 동물의 아이디

select ANIMAL_ID
from ANIMAL_INS
where NAME is NULL

2. 이름이 있는 동물의 아이디

select ANIMAL_ID
from ANIMAL_INS
where NAME is not null
order by ANIMAL_ID

3. NULL 처리하기

select ANIMAL_TYPE,
case when NAME is null then 'No name' else NAME end NAME,
SEX_UPON_INTAKE
from ANIMAL_INS
order by ANIMAL_ID