近似統計関数
GoogleSQL には、大規模データセットでより高いパフォーマンスを発揮する4つの近似集計関数があります: APPROX_COUNT_DISTINCT、APPROX_QUANTILES、APPROX_TOP_COUNT、APPROX_TOP_SUM。この演習では、各関数を使って同じクエリを順に実行していきます。
この演習はコースの一部です
BigQuery入門
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
-- Complete the query to approximate the number of customers that have ordered each product
SELECT
items.product_id,
-- Add the correct syntax for the approximate distinct count
___ AS estimated_unique_customers
FROM ecommerce.ecomm_orders o, UNNEST(o.order_items) items
JOIN ecommerce.ecomm_order_details od USING (order_id)
GROUP BY items.product_id;