MySQL provides 2 ways to check truth value of boolean columns, those are column_variable = true and column_variable is true. I created
MySQL is actually fooling you. It doesn't have a boolean column type at all:
BOOL,BOOLEANThese types are synonyms for
TINYINT(1). A value of zero is considered false. Nonzero values are considered true:
Also, the boolean literals are not such:
The constants
TRUEandFALSEevaluate to 1 and 0, respectively.
Considering that:
0 or 1 in BOOLEANMy conclusion would be:
WHERE IS flag or just WHERE flag because = simply doesn't work correctly. Which one, is possibly a matter of preference.Edit: if cross-platform is a must, I'd go for this:
WHERE flag=0
WHERE flag<>0
I'm sure we've all done it lots of times.