3 ms·
> In dbs, null means that the value is unknown and can't be reasoned about. Except it can also mean it's `null` in that the field is optional and the record do
by onlyrealcuzzo 4y ago
> In dbs, null means that the value is unknown and can't be reasoned about.
Except it can also mean it's `null` in that the field is optional and the record doesn't have it.
- adamzochowski 4y agoAn optional value just means that the value is unknown. For example, it is optional to enter the colour of the car I own. So my car colour is null. The database can't confirm if my car is Red or isn't Red, because it is an unknown value.
- tremon 4y agoNot really. A null value in a certain column does not indicate that the field is optional; instead, the table definition having a nullable column indicates that the field is optional. A null value in a nullable column indicates only that the value is unknown, nothing else. This is database modeling 101: A table ("relation") describes one entity. The attributes of the entity are reflected in the table column set, and each table row represents a different instance of said entity. Marking a column as nullable means that not knowing that attribute is a recoverable situation (for example, because it is only stored for informational purposes and not for processing). If you're using the same table to store multiple entities, using nullable columns to indicate if a row represents entity A or entity B, you're doing it wrong.