Get startedGet started for free

Logical aggregates

The last set of special aggregate functions you will use are the logical operators LOGICAL_AND and LOGICAL_OR. These provide an efficient way to find if any data set contains a true boolean. This helps when grouping by data to quickly see if all or one of those values is true. For example, this exercise will look at groups of data to see if they have been delivered or if at least one of the values has been delivered.

This exercise is part of the course

Introduction to BigQuery

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

-- Complete the query using LOGICAL_AND

SELECT
  customer_id,
  -- Fill in the LOGICAL_AND function
  ___ as all_delivered
FROM ecommerce.ecomm_order_details
GROUP BY customer_id;
Edit and Run Code