What is NULL in MySQL? Is NULL the same as 0 or an empty string?
NULL means “no value” or “unknown”. It is not zero and not an empty string.
SELECT NULL = NULL, NULL IS NULL, 0 IS NULL, '' IS NULL;
Tutorials Class - Output Window
| NULL = NULL | NULL IS NULL | 0 IS NULL | ” IS NULL |
|---|---|---|---|
| NULL | 1 | 0 | 0 |
NULL = NULL gives NULL (not true). Always use IS NULL and IS NOT NULL. Aggregate functions ignore NULL, and COALESCE(column, 0) replaces NULL with a value.
Learn more about the similar topics:
| Tutorials |
|---|
| MySQL SELECT Statement |
| MySQL WHERE Clause |
| MySQL AND, OR and NOT |
| MySQL ORDER BY |
| MySQL LIMIT |
| MySQL DISTINCT |
| MySQL LIKE and Wildcards |