Tuesday, April 24, 2018

THREE-VALUED LOGIC

-- this is true
SELECT 1 WHERE 1 = 1

-- this is false
SELECT 1 WHERE 1 = 0

-- this is unknown - it is usually expected to be false, but that only shows 
-- misunderstanding of nulls. It's not false it's only treated as false in the filter
SELECT 1 WHERE 1 = NULL

-- this is also unknown - but logicaly it would seem it would be true
-- but unknown compared to unknown equals uknown and it is treated as false in the filter
SELECT 1 WHERE NULL = NULL

No comments:

Followers

Link