BOOL_AND

Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API

Returns true if all input values are true; otherwise returns false.

Syntax

bool_and(<expression>)

Arguments

Required

  • <expression>: An expression of type boolean.

Returns

Returns a boolean value. Returns NULL if no rows are selected.

Considerations

  • NULL values are ignored in the calculation.
  • Equivalent to the EVERY function.

Examples

Check All True

Check if all orders are shipped.

SELECT bool_and(is_shipped) AS all_shipped
FROM orders
WHERE order_date = '2024-01-15';

Validate by Group

Check conditions for each group.

SELECT department, bool_and(is_active) AS all_active
FROM employees
GROUP BY department;

Related Documentation