Null Arithmetic and Comparisons in SQL
- when operators have a
NULL operand,
- when a
WHERE clause evaluates to NULL, row is not selected
IS NULL Operator
- comparison operators cannot be used to select
NULL values
- use
IS NULL and IS NOT NULL operators to select NULL values
NULL Logic
- Expressions can be
TRUE, FALSE, or NULL
NULL indicates the value of the expression is uncertain
- value of logical expressions is contained in truth tables
| x | y | x AND y | x OR y |
|---|
| TRUE | NULL | NULL | TRUE |
| NULL | TRUE | NULL | TRUE |
| FALSE | NULL | FALSE | NULL |
| NULL | FALSE | FALSE | NULL |
| NULL | NULL | NULL | NULL |
| — | | | |