I prefer thinking of Unknown as Null and like the zero in multiplication it is absorbant for a lot of comparator operators (=, , =). So instead of having 4 states (true, false, null, and unknown) to consider, when I evaluate a Boolean expression I use only 3 states (true, false and null). And NULL when is the final value evaluates to FALSE in a WHERE predicate or in a WHEN and IF statement. Also, it mirrors the uses of the empty set (∅) when you use null with the operator AND (equivalent to intersect operator (⋂) for sets, not to confuse with INTERSECT used between multiple SELECT statement) and the operator OR (equivalent to union operator (⋃) for sets ). So, (NULL AND Y) ≡ NULL and (NULL OR Y) ≡ Y. The same as (∅ ⋂ Y) ≡ ∅ and (∅ ⋃ Y) ≡ Y. Or as (0 × Y) ≡ 0 and (0 + Y) ≡ Y.
@POWERTOKNOW2 жыл бұрын
Good Video ,The ONLY thing it did not cover with respect to NULLS is the Behaviour of NULLS wrt to GROUP BY Clause.