sqlnulllogicgrammardatabase-agnostic

SQL 4-valued logic table


What are the truth tables for the proposed 4-value logic in SQL that has both an A-value null and an I-value null? From here.

Using AND for this, 3VL looks like this:

enter image description here

How would the following table look?

enter image description here


Solution

  • You are confusing the representation of the UNKNOWN truth value as a null, with a real null stored in the database.

    SQL defines three boolean values. Namely: True, False, and Unknown. The latter is represented by a null (but it's not a null).

    Now, a bona fide SQL null represents a value that exists but that is just missing. For example: "we haven't got the birth date of Anne"; we know she has one, but we just don't have it on record yet. This corresponds to a Codd's A-value.

    Codd's I-value corresponds to a value that cannot be later replaced by a real value, since this one doesn't actually exists. I-values are not currently represented in SQL.

    Therefore, when you realize that nulls are only used in boolean logic to represent the Unknown value, then it's clear that they are unrelated to an A-value or an I-value; they live in separate domains. A 4-valued logic (with A an I values) doesn't make any sense since both of them don't really represent any boolean value.