BaşlayınÜcretsiz Başlayın

STRING_AGG ve ARRAY_CONCAT_AGG kullanımı

Hatırlarsan, özel toplulaştırmalar üç ana gruba ayrılıyordu. Bu egzersizde, metin ve dizi toplulaştırmalarına odaklanan iki sorguyu adım adım göreceğiz. Bu iki fonksiyonu orders ve order_details verilerimizi kullanarak keşfedebiliriz.

Bu egzersiz

BigQuery'ye Giriş

kursunun bir parçasıdır
Kursu Görüntüle

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

-- Fill in the query to find the distinct product categories for each order

SELECT
    o.order_id,  
    -- Use the STRING_AGG to find distinct values and separate them by a comma with a space
    ___(___ product_category_name_english, ___) AS categories
FROM
    ecommerce.ecomm_orders o, UNNEST(order_items) items
JOIN
    ecommerce.ecomm_products p ON items.product_id = p.product_id
-- Find the number of items in the order_items column
WHERE ___(o.order_items) > 1
GROUP BY
    order_id
Kodu Düzenle ve Çalıştır