3 ms·
In general, it's recommended to use NOT NULL in SQL as well. In practice, NULL causes many SQL statements to require 2 conditionals for logic instead of 1, intr
by redis_mlc 6y ago
In general, it's recommended to use NOT NULL in SQL as well. In practice, NULL causes many SQL statements to require 2 conditionals for logic instead of 1, introducing subtle bugs.
There are exceptions, but I haven't seen many. One useful one is if you want a unique index on a column and you can't use "", you can use NULL.
Another is if you need the full range of a column, plus indicating whether data was supplied or not. I see that more with applications involving money, whereas the empty string works fine for most tables used in SaaS and social applications.
Source: DBA.