Rules of Precedence

When your SQL contains complex expressions, the subexpressions are evaluated based on MySQL’s rules of precedence. Of course, you may always override MySQL’s rules of precedence by enclosing an expression in parentheses.

  1. BINARY

  2. NOT

  3. - (unary minus)

  4. * / %

  5. + -

  6. << >>

  7. &

  8. |

  9. < <= > >= = <=> <> IN IS LIKE REGEXP

  10. BETWEEN

  11. AND

  12. OR

Get Managing & Using MySQL, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.