IniziaInizia gratis

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.

Questo esercizio fa parte del corso

Introduction to BigQuery

Visualizza il corso

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

-- 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;
Modifica ed esegui il codice