4 ms·
Most people experience the same when using DB, NULL in a database is hard to distinguish from, data never stored or data don't exist.
by segmondy 8y ago
Most people experience the same when using DB, NULL in a database is hard to distinguish from, data never stored or data don't exist.
- kbenson 8y agoDo you mind explaining what you mean? To my knowledge, inspecting the number of rows returned eliminates this problem.
- RHSeeger 8y agoI think he's referring to something like a row with First, Middle, and Last name fields. If the Middle name field is null, does it mean "we don't known this value" or "this value is <nothing> (the person doesn't have a middle name)". For most database schemas, there is no way to tell the difference between the two states.
- fegu 8y agoThe latter case, no middle name, should be stored as an empty string. In practice, not enough care is devoted to the difference between Null and empty string for text fields.
- no-s 8y ago"First not null, Middle null, Last not null" represents an a priori assumption that everyone has a First, Middle, and Last - but sometimes we don't know what the Middle is. Allowing a zero length string in any of those attributes implies that some rows in a table have First, Middle, or Last represented by a zero length string. What a zero-length string actually means is subject to interpretation and thus beyond the data model. in the real world it turns out not to be useful to require that people have names just in order to keep data about them...nor does a name particularly distinguish one person from another.
- nradov 8y agoWhile this is overkill for most applications, the HL7 V3 data types used in healthcare even have multiple different "flavors" of null. So you can distinguish between "no information", "unknown", "not asked", etc. https://www.hl7.org/implement/standards/product_brief.cfm?product_id=358 https://www.hl7.org/implement/standards/product_brief.cfm?pr...