Search notes:

SQL precedence (AND, OR)

In most RDMBS (all?), and has a higher precedence than or when used in a where clause.
Because of this precedence rule, and conditions are evaluated before or conditions.
where condition is true:
select count(*) from …
where
   1 = 1            or
   1 = 2 and 1 = 3
;
where condition is false
select count(*) from …
where
   1 = 0            or
   1 = 1 and 1 = 3
;

Index