Null Values

As we know, NULL stands for "value is unknown (yet)".

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



and can’t remember any usecase for NULL strings (except, maybe, indexing stuff).

How do you define your string fields that can be empty?

I do that by null or ‘’, But there is diffrence between them:

I tend to use the empty string now, rather than null. You’re right that there are few uses for a null string, except maybe for differentiating between an unknown value and a value that you know is the empty string. This led Oracle to this highly debatable decision.

I always use null values in the DB and PHP to mark empty fields. I never allow empty strings in user input and treat them as null values.

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).