SQL AND is a logical operator that combines two or more Boolean expressions and yields TRUE only when every operand is TRUE. It is commonly used in WHERE, HAVING, JOIN ON, and CHECK clauses to narrow result sets and enforce data integrity. AND follows three-valued logic: if any operand is FALSE the result is FALSE; if all operands are TRUE the result is TRUE; if no operand is FALSE and at least one is UNKNOWN (NULL comparison) the result is UNKNOWN, which filters out rows in WHERE or HAVING. Operator precedence places NOT first, then AND, then OR, so AND binds more tightly than OR unless parentheses override this order. Most databases allow chaining multiple AND conditions without limits. Indexes can optimize AND filters when columns are indexed independently or with composite indexes, but implicit functions or type mismatches on indexed columns may prevent index use.
expression1
(BOOLEAN) - First condition to evaluateexpression2
(BOOLEAN) - Second condition to evaluateexpression3 ...
(BOOLEAN) - Optional additional conditions to evaluateOR, NOT, WHERE, HAVING, JOIN ON, XOR, BETWEEN, CASE
SQL-86 (ANSI X3.135-1986)
Yes. NOT is evaluated first, AND second, OR last. Parentheses let you override this order.
If any operand is NULL and none is FALSE, the result is UNKNOWN, which filters out the row in WHERE or HAVING clauses.
Too many low-selectivity filters can cause full scans. Proper indexing or composite indexes help.
Wrap expressions in parentheses to ensure they are evaluated before or after other logical operators.