Skip to content
SQLSimplified
aggregate

BOOL_OR()

Returns TRUE if at least one value in the group is TRUE (logical OR across rows).

Description

BOOL_OR is an aggregate function that returns TRUE if any row in the group satisfies the condition (a logical OR across rows). Use it for questions like "did any employee in this department get a bonus?"

Syntax

BOOL_OR(expression)

Parameters

NameDescriptionOptional
expressionA boolean expression evaluated per row.No

Return Type

Returns a BOOLEAN. An empty group typically returns NULL (or FALSE in some engines for an empty OR).

Examples

Employees & Departments

Loading database engine...

Employees & Departments

Loading database engine...

Great for existence checks

BOOL_OR(condition) is a clean way to ask "does any row match?" inside a grouped query, without a subquery.

Common Mistakes

  • Confusing with OR in WHERE. BOOL_OR aggregates across rows; OR in WHERE tests a single row.
  • Empty groups. May return NULL rather than FALSE — guard if needed.
  • Non-boolean input. The argument must be boolean.

See also: BOOL_AND, EVERY.

Search

Search lessons, functions, examples, and practice problems