There is no boolean data type in SQL, BIT
is kind of a hack, but the main problem is that due to the SQL concept of NULL
true boolean logic is impossible (for example, what would your query return if price
was NULL
?)
Note that I'm not saying that there are not possible ways to implement boolean logic that "mostly" work (for example, you could say that TRUE OR NULL
is NULL
or whatever) just that the people who designed the SQL standard couldn't decide on The One True Representation for boolean logic (for example, you could also argue that TRUE OR NULL
is TRUE
, since TRUE OR <anything>
is TRUE
).
The boolean expressions (=, <=, >=, etc) are only valid in certain places (notably, WHERE
clauses and CASE
labels) and not in any other place.