शुरू करेंमुफ़्त में शुरू करें

STRING_AGG और ARRAY_CONCAT_AGG का उपयोग

जैसा कि आपने देखा, विशेष aggregations तीन मुख्य समूहों में बँटते हैं। इस अभ्यास में आप दो क्वेरी चलाएँगे जो string और array aggregations पर केंद्रित हैं। हम इन दोनों फंक्शनों को अपने orders और order_details डेटा के साथ एक्सप्लोर करेंगे।

यह अभ्यास पाठ्यक्रम का हिस्सा है

BigQuery परिचय

पाठ्यक्रम देखें

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

-- 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
कोड संपादित करें और चलाएँ