SQL OR is a logical operator used to combine two or more Boolean expressions in a WHERE, HAVING, JOIN, or CASE clause. If any of the expressions evaluates to TRUE, the entire OR condition is TRUE. When all expressions are FALSE or NULL, the result is FALSE. NULL behaves like UNKNOWN; if one operand is TRUE and another is NULL, the overall result is TRUE because OR only needs one TRUE. OR has lower precedence than AND, so parenthesis are recommended when mixing operators. OR supports any comparison operator ( =, <>, IN, LIKE, BETWEEN, EXISTS ) and subqueries. Excessive OR chains can hurt performance because most query planners cannot use indexes efficiently across multiple OR predicates; consider UNION ALL or derived tables when many ORs reference the same indexed column.
AND, NOT, XOR, WHERE, HAVING, CASE, IN, BETWEEN
SQL-86 (ANSI X3.135-1986)
OR tests multiple conditions and returns TRUE when any single condition is TRUE, enabling flexible filtering in SELECT, UPDATE, DELETE, and JOIN clauses.
Some engines evaluate operands left to right and stop on the first TRUE, but the SQL standard does not require short-circuiting. Rely on documentation for your database.
Replace long OR chains on the same column with IN, UNION ALL, or a derived table to leverage indexes more effectively.
OR returns TRUE when any condition is TRUE. XOR (exclusive OR) returns TRUE only when exactly one condition is TRUE; support for XOR is vendor-specific.