Skip to main content

Overview

The BOOL_AND() window function evaluates whether all values within a specified window of rows are TRUE.

Syntax

The syntax for this function is as follows:

Parameters

  • expression: column or expression that the function operates on. It should evaluate to a boolean value (TRUE or FALSE)

Example

For the needs of this section we will use a simplified version of the film table from the Pagila database, containing only the title, length and rating columns. The complete schema for the film table can be found on the Pagila database website.
The query below uses the BOOL_AND() function to evaluate if all films in each rating category have a length greater than 100:
By running the above code, we will get the following output: