[프로그래머스][MYSQL][Level 2][59410] NULL 처리하기

문제 링크

문제링크

정답

1
2
3
4
5
6
SELECT 
    ANIMAL_TYPE, 
    CASE WHEN NAME IS NULL THEN "No name" ELSE NAME END,
    SEX_UPON_INTAKE
FROM 
    ANIMAL_INS

정답2

1
2
3
4
SELECT
    ANIMAL_TYPE, IFNULL(NAME,'No name') AS NAME, SEX_UPON_INTAKE
FROM
    ANIMAL_INS

정답3

1
2
3
4
5
6
7
8
SELECT 
    ANIMAL_TYPE, 
    CASE WHEN NAME IS NULL THEN "No name" ELSE NAME END,
    SEX_UPON_INTAKE
FROM 
    ANIMAL_INS
ORDER BY
    ANIMAL_ID

Success Notice: 수고하셨습니다. :+1:

Leave a comment