Live data from Hacker News

SQL nulls are weird

jirevwe.github.io

291–293 of 293 posts

Re: SQL nulls are weird

#291

When the null concept was introduced to me in the seventies, the only thing I could say was that it would be causing a lot of unnecessary confusion in the future. If you have missing values in your datarecord then that datarecord belongs in an exception-queue. And now some 45 years later people are still discussing it like we did then..

> If you have missing values in your datarecord then that datarecord belongs in an exception-queue. This depends on the context, no? I doubt there exists someone with a contact list on their phone which has every single field for every single contact populated. There needs to be some way to codify that a field in a datarecord is unpopulated. Using the "zero value" for the type of the field (e.g., the empty string) is…

I did last week, before I added the first contact.

Re: SQL nulls are weird

#292
post #290

Earlier quoted context omitted.

And yet when you do a join because you need to actually use that data, the resulting table will have a column with nulls in it. Any way you squeeze it, you need a way to represent empty values for your database to be useful.

An inner join? Then there wouldn't be any nulls.

IDK, do you want to exclude people without a middle name or a second address line when examining a product order list? I'll leave that one for you to decide.

Re: SQL nulls are weird

#293
post #72

Earlier quoted context omitted.

UNDEFINED would not be accurate. If your signup form has an optional field for a full name which I don’t fill in, I still have a name. Just because a value is not known by your database doesn’t mean it isn’t defined. E. F. Codd thought about this issue.[0] > Codd indicated in his 1990 book The Relational Model for Database Management, Version 2 that the single Null mandated by the SQL standard was inadequate, and sho…

> If your signup form has an optional field for a full name which I don’t fill in, I still have a name. Just because a value is not known by your database doesn’t mean it isn’t defined. There's the Closed World Assumption in a database.

It’s often a bad idea to make that assumption.
Post reply on HN