IS NULL 조건식은 왼쪽에 지정된 표현식의 결과가 NULL인지 비교하여, NULL인 경우 TRUE를 반환하며, 조건절 내에서 사용할 수 있다. NULL 키워드 앞에 NOT이 있으면 IS NULL 연산의 결과에 NOT 연산을 수행하여 결과를 반환한다.
expression IS [ NOT ] NULL
--selecting rows where salary is NULL
SELECT * FROM condition_tbl WHERE salary IS NULL;
=== <Result of SELECT Command in Line 1> ===
id name dept_name salary
======================================================================
7 'Brown ' 'account' NULL
--selecting rows where salary is NOT NULL
SELECT * FROM condition_tbl WHERE salary IS NOT NULL;
=== <Result of SELECT Command in Line 1> ===
id name dept_name salary
======================================================================
1 'Kim ' 'devel' 4000000
2 'Moy ' 'sales' 3000000
3 'Jones ' 'sales' 5400000
4 'Smith ' 'devel' 5500000
5 'Kim ' 'account' 3800000
6 'Smith ' 'devel' 2400000
--simple conparison operation returns NULL when operand is NULL
SELECT * FROM condition_tbl WHERE salary = NULL;
=== <Result of SELECT Command in Line 1> ===
There are no results.
0 rows selected.