Both statements Insert a value into the phone column, but the first inserts a NULL value and the second inserts an empty s Tring. The meaning of the first can be regarded as "phone number are not known" and the meaning of the second can regarded as " The person was known to has no phone, and thus no phone number. "
MySQL:: MySQL 8.0 Reference Manual:: b.5.4.3 problems with NULL Values
Null: Unknown, value not set
Empty string ("): null, set but null value
For MyISAM tables, NULL columns require additional space in the row to record whether their values is NULL. Each of the NULL column takes one bit extra, rounded up to the nearest byte.
MySQL:: MySQL 5.7 Reference Manual:: c.10.4 Limits on Table Column Count and Row Size
I see a lot of blog on the Internet is written in the MyISAM null accounted for one, empty string (") one does not occupy, I feel a bit of a problem (should be set to NULL when creating the table field will be more than one to save null) but use Information_ The Data_length field test for the tables table of the schema database found that the increment of either inserting null or empty string (') is the same:
PS: Using the select length(‘‘), length(null) query result is really a ' length of 0
mysql> select length(‘‘), length(null);+------------+--------------+| length(‘‘) | length(null) |+------------+--------------+| 0 | NULL |+------------+--------------+
Conclusion:
Because the processing of NULL is laborious, and when Null is said to not walk the index, in addition to special cases or empty string ("") convenient point (as if there is nothing to do with it).
Mysql-default settings