Why is MySQL assessment (TRUE or TRUE and FALSE) TRUE?

If you enter

SELECT (true or true and false)

In mysql, It will return 1, which is true. Why is this happening? What is the order of evaluation in Boolean expressions?

According to the MySQL documentation on operator precedence, AND is evaluated before OR. This means your expression The formula (true or true and false) is calculated as (true OR(true AND false)).

If you enter

< pre>SELECT (true or true and false)

In mysql, it will return 1, which is true. Why is this? What is the order of evaluation in Boolean expressions?

According to the MySQL documentation on operator precedence, AND is evaluated before OR. This means that your expression (true or true and false) is calculated as ( true OR(true AND false)).

Leave a Comment

Your email address will not be published.