I know about the boolean
column type, but is there a boolean
literal in SQLite? In other languages, this might be true
As everyone else has pointed out, SQLite does not support a specific boolean storage type, and the OP specifically acknowledges this fact. However, this is completely independent of whether SQLite supports boolean literals and comprehensions.
For anyone wondering, the answer is YES, since SQLite 3.23 you can do boolean comprehensions with the boolean literals TRUE
and FALSE
, and it will work how you expect.
For example, you can do:
SELECT * FROM blah WHERE some_column IS FALSE;
SELECT * FROM blah WHERE some_column IS TRUE;
and it will work how you expect if you are using 0
for false and 1
for true.
From my testing, here is how SQLite matches various values:
IS TRUE
IS FALSE
IS NULL
. Does not match IS TRUE
or IS FALSE
.IS FALSE
. Even values like "t", "TRUE", "true", "True" still match IS FALSE