2 ms·
I remember from my databases course at university that NULL means that the database doesn't contain that data, and empty string means that it is known to be emp
by andai 2y ago
I remember from my databases course at university that NULL means that the database doesn't contain that data, and empty string means that it is known to be empty.
- niij 2y agoWhat is the type is something other than a string? age: null? married: null?
- feoren 2y agoThat's your professor's opinion, and probably one that does not come from industry experience. Look in 4 different databases and you'll see 9 different conventions. A common one is to have all strings non-null with a default value of empty string. And not all columns are strings; there is no "obviously empty" integer or boolean.
- zo1 2y agoLet's also all be reminded about how Oracle DB doesn't let you insert empty strings, and instead treats them as NULLS even if you gave it an empty string initially. https://stackoverflow.com/questions/203493/why-does-oracle-9i-treat-an-empty-string-as-null https://stackoverflow.com/questions/203493/why-does-oracle-9... That was a fun bug to find out, after having dealt with quite a few other DBs over the years. It was one of those "No, but surely" and "This can't be! This is Oracle!" moments. Found it while porting some old code that needed to store an empty string as being distinct from a NULL in that same column.
- deleted 2y ago[deleted]