Tuesday, April 24, 2018

THREE-VALUED LOGIC

-- this is true
SELECT 1 WHERE 1 = 1
Output : 1

-- this is false
SELECT 1 WHERE 1 = 0
Ouput :No Output

-- 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
Ouput :No Output

-- 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
Ouput :No Output

No comments:

Followers

Link