AND, OR, and NOT, Part 1 of 3
> AND, OR, and NOT are Boolean operators designed to work with truth values: TRUE, FALSE, or NULL.
> The ANSI/ISO standards specify that NOT has the highest precedence, followed by AND, and then OR.
> Default precedence rules say that x AND NOT y OR z is equivalent to (x AND (NOT y)) OR z.
SELECT column1, column2, ...
FROM table1, table2, ...
WHERE testcolumn1 [NOT] condition1
[AND | OR] testcolumn2 [NOT] condition2 ...;
> AND is used to combine two search conditions where both must be true.
> OR is used to combine two search conditions where one or the other (or both) must be true.
> NOT is used to select rows where a search condition is false.
Here are the appropriate truth tables:
In MySQL 4.0.4 and earlier, FALSE AND NULL evaluate to NULL, not FALSE.
It is always a good idea to use parentheses to remove ambiguity.


