• L' Eomot Inversé (8/23/2013)


    Hugo Kornelis (8/23/2013)


    Now you're doing the same as you did in the start - simplyfying "it isn't known to the database" to "it isn't known". You are far from alone in that confusion

    ....

    ....

    And when I write "WHERE is_smoker IS NULL", I am indeed looking for people for whom we do not know whether they smoke or not.

    And there you fall into exactly the simplification that I use. So if it is indeed a confusion, I have you for company.

    No, there I apply my knowledge of the context. I know that in the context of the is_smoker column, a NULL represents unknown. I thought that was clear from the context of the message.

    It's all very well to talk about the context; but often when you come to look at some SQL you don't have that context - you just have the code, including if you are lucky the scripts that generate the schema and all its constraints, and of course you have the data. (...)

    (Shortened the quote down to the essence)

    Or another way to put it: "In theory, there is no difference between theory and practice. In practice, there is".

    And yet, when we work with a table and see the number 42 in a column, we can usually deduct from the limited context available (column name, existing code, other data in the same column) how to interpret it. The same applies for a NULL, In both cases, the deduction may not be correct all the time, but most of the time, we do get it right.

    I'll leave it at this. It's late and I've worked way too hard today, so I need to relax and sleep. After I respond on one other forum topic.


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/