Last active
July 10, 2020 16:31
-
-
Save kovid-r/3ab93e4f9184748e61ccdd159d5a7f5a to your computer and use it in GitHub Desktop.
How integers are evaluated in SQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Where evaluates the condition finally to a TRUE or FALSE */ | |
SELECT 1 WHERE 1; -- returns one record | |
SELECT 1 WHERE 0; -- returns nothing | |
SELECT 1 WHERE 0.001; -- returns one record | |
/* Any non-zero number evaluates to TRUE and zero evaluates to FALSE */ | |
SELECT 1 = TRUE; -- returns one record | |
SELECT 0 = FALSE; -- returns one record | |
SELECT 1 = FALSE; -- returns nothing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment