LoslegenKostenlos loslegen

Create an array in a query

Sometimes, when you aggregate data, you will still want to preserve some of the original data, and using ARRAY provides a great structure to do this. For example, in this query, you will create a new ARRAY by writing a subquery to do so.

Diese Übung ist Teil des Kurses

Introduction to BigQuery

Kurs anzeigen

Anleitung zur Übung

  • Create an array of product_id for products weighing 2,220 grams. First, check the ecomm_products table to identify the column that stores weight information.

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

-- Fill in the query to construct the array

SELECT
	ARRAY(SELECT 
          -- Add the column with the values you want in the array
          	___ 
          FROM 
          	ecommerce.ecomm_products
          WHERE
          	-- Add the column we want to filter by
         	___ = 2220)
Code bearbeiten und ausführen