MySQL logical operators

后端 未结 4 1245
旧时难觅i
旧时难觅i 2021-01-14 23:40

Given the query \'SELECT foo FROM bar WHERE a = x AND b = y OR c = z\', how does it parse this query?

(a = x AND b = y) OR c = z?

4条回答
  •  不知归路
    2021-01-15 00:28

    from the MySQL manual section 11.2.1. Operator Precedence: http://dev.mysql.com/doc/refman/5.0/en/operator-precedence.html

    AND has precedence over OR. (a = x AND b = y) OR c = z is the equivalent expression.

提交回复
热议问题