aggregate

BOOL_AND

Tests whether every non-NULL Boolean input is true. An empty or all-NULL group produces NULL; it is not automatically true. Example target: PostgreSQL 17; inline synthetic data; no extensions.

Formal Syntax & Structure

sql syntaxsql
BOOL_AND(boolean_expression)

Working Example

Example Snippetsql
WITH sample(id,x,y) AS (VALUES (1,1,2),(2,2,4),(3,3,6),(4,4,8),(5,NULL,4)) SELECT bool_and(x > 0) FROM sample;
SQL Reference