By using NULL you can distinguish between “put no data” and “put empty data”.
Some more differences:
-
A
LENGTHofNULLisNULL, aLENGTHof an empty string is0. -
NULLs are sorted before the empty strings. -
COUNT(message)will count empty strings but notNULLs -
You can search for an empty string using a bound variable but not for a
NULL. This query:SELECT * FROM mytable WHERE mytext = ?will never match a
NULLinmytext, whatever value you pass from the client. To matchNULLs, you’ll have to use other query:SELECT * FROM mytable WHERE mytext IS NULL