SELECT ANIMAL_ID FROM ANIMAL_INS WHERE NAME IS NULL ORDER BY ANIMAL_ID;
SELECT ANIMAL_ID FROM ANIMAL_INS WHERE NAME IS NOT NULL ORDER BY ANIMAL_ID;
SELECT ANIMAL_TYPE, IFNULL(NAME, "No name") AS NAME, SEX_UPON_INTAKE FROM ANIMAL_INS ORDER BY ANIMAL_ID;
IFNULL(a,b)
-a가 null이면 b로 대체
'📚 Programming > SQL' 카테고리의 다른 글
[MYSQL] Data INSERT, UPDATE, DELETE (0) | 2021.02.25 |
---|---|
[MYSQL] 우유와 요거트가 담긴 장바구니 (0) | 2021.02.16 |
[MYSQL] SELECT groupby FROM Programmers (0) | 2021.01.31 |
[MYSQL] SELECT sum,max,min FROM Programmers (0) | 2020.12.30 |
[MYSQL] SELECT select FROM Programmers (0) | 2020.12.26 |