Why does mysql evaluate (TRUE or TRUE and FALSE) to true?
If you type
SELECT (true or true and false)
in mysql it will return 1
which is true
. Why is this so? What is the order of evaluation in boolean expressions?
+3
Sequoia
source
to share
1 answer
According to the MySQL documentation on operator precedence , AND evaluates to OR.
This means your expression (true OR true AND false)
evaluates to (true OR (true AND false))
.
+7
Mr. Llama
source
to share