Skip to main content

NULL values

A NULL value indicates "no data".

NULL is case-insensitive. Its synonym is \N (case-sensitive). Note that a NULL value is different from the number 0 and the empty string ''.

When you use ORDER BY, for ascending order, NULL values appear before other values; for descending order, NULL values appear after other values.

The LOAD DATA and SELECT ... INTO OUTFILE statements support using \N to represent NULL.

Here is an example:

SELECT 1, NULL, \N FROM dual;

The result is as follows:

+------+------+------+
| 1 | NULL | NULL |
+------+------+------+
| 1 | NULL | NULL |
+------+------+------+
1 row in set