No parens in where clause

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I cannot find now, what the precedence is in the where clause of a select
statement, where "AND" and "OR" are mixed in, and there are no parentheses.

For example:

WHERE a=1 and b=2 or c=3

How would that be "parenthesized" internally in MySQL? What is the rule for
precedence between and and or? Thanks IKe

Re: No parens in where clause

Ike wrote:
Quoted text here. Click to load it

AND has higher precedence than OR.


   WHERE (a=1 AND b=2) OR c=3

FWIW, this is the same boolean operator precedence as in virtually any
other programming language you care to mention.

See also

Bill K.

Site Timeline