본문 바로가기
IT/SQL

[SQL] NULL 다루기

by 저당단 2024. 10. 31.

프로그래머스 SQL kit의 IS NULL 파트 문제를 풀면서 정리합니다.

 

Null 값 처리 방법

 

Solved-Algorithm/MySQL/프로그래머스/2/59410. NULL 처리하기 at main · ParkBible/Solved-Algorithm

This is an auto push repository for Baekjoon Online Judge created with [BaekjoonHub](https://github.com/BaekjoonHub/BaekjoonHub). - ParkBible/Solved-Algorithm

github.com

SELECT IFNULL(컬럼명, "바꿀 값") FROM 테이블;

 

특정 컬럼에 Null 값이 포함되어 있을 때 다른 값으로 교체하고 싶다면 IFNULL을 이용한다.

 

 

Null 값 확인하기

 

Solved-Algorithm/MySQL/프로그래머스/3/273712. 업그레이드 할 수 없는 아이템 구하기 at main · Pa

This is an auto push repository for Baekjoon Online Judge created with [BaekjoonHub](https://github.com/BaekjoonHub/BaekjoonHub). - ParkBible/Solved-Algorithm

github.com

SELECT * FROM 테이블 WHERE 컬럼명 IS NOT NULL;

 

NULL이 아닌 로우만 조회할 때 쓰는 문법이다.