Posted 01 December 2013 - 12:18 PM
So it can be used as a default value for foreign key, when there's no related record (actually, nulls are the only way to unset FK in most DBs except MySQL+MyISAM).
But is there such a thing as "value is known and it's empty" for STRING types?
PS. I was thinking about difference between
field_1 TEXT NULL
field_1 TEXT NOT NULL DEFAULT ''
and can't remember any usecase for NULL strings (except, maybe, indexing stuff).
How do you define your string fields that can be empty?
Posted 01 December 2013 - 01:14 PM
Posted 04 December 2013 - 06:20 AM
Posted 04 December 2013 - 06:40 AM
I can think of only one example where empty strings could be used along with null values. Null could mean the user has not entered any value and empty string could indicate that he WAS entering values but choose not to fill a specific field. But that requires the ability to save partially filled records and in most cases you just split it into two tables and use relations.
So it is confusing and I suggest using null values, not empty strings - because this is more universal considering data types other than strings (there are no "empty" integers).