Timeline for SQL: empty string vs NULL value
Current License: CC BY-SA 2.5
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Aug 8, 2012 at 16:04 | comment | added | Thomas | No null values. This is the Ostrich approach. "We'll stick our head in the sand and declare that absent values do not exist". That usually leads to the Magic Value Solution where you have to come up with a magic value for each data type to represent an absence of a value. | |
| Aug 8, 2012 at 16:00 | comment | added | Thomas | Empty cell and null are both way to mark something is wrong. Not true. A null is a way to indicate an absence of a value. I bet most RDBMS use a bit array on each row to indicate which columns are null. Thus, the additional space is so tiny as to be irrelevant. Worrying about the additional processing is premature optimization and will be nothing compared to the speed bumps created for other developers to "discover" that you have intentionally used empty strings. | |
| Feb 21, 2011 at 0:01 | comment | added | dan04 | Don't forget that a VARCHAR column will take at least 1 byte to store the length of the string, even if it's zero. | |
| Jan 4, 2011 at 8:44 | comment | added | Jacek Prucia | I vaguely recall reading somewhere that using NULL is actually a cost (both in terms of computation and storage) for the database. So good point in bringing that formula up. | |
| Dec 30, 2010 at 14:40 | history | edited | Slawek | CC BY-SA 2.5 | added 96 characters in body |
| Dec 30, 2010 at 14:35 | history | answered | Slawek | CC BY-SA 2.5 |