728x90
- 데이터가 없는 title 컬럼에 'MISSING'이라고 채우려고 한다.
select students.first_name,
case
when papers.title is null then 'MISSING'
else papers.title
end as title
from students
left join papers
on students.id = papers.student_id;
※ is null 부분
when papers.title = null then 'MISSING'
= 을 사용하면 안됨 is 를 사용 해야함
'MySQL_Workbench' 카테고리의 다른 글
MySQL ifnull 함수 사용법 (0) | 2021.12.09 |
---|---|
MySQL case문 작성법 (0) | 2021.12.09 |
MySQL 특정 문자 포함 검색 like (0) | 2021.12.08 |
MySQL 제외하고 가져오기 (0) | 2021.12.08 |
MySQL 날짜와 시간 처리 curdate, curtime, now... (0) | 2021.12.08 |