开始使用免费开始使用

近似统计函数

GoogleSQL 提供了 4 个近似聚合函数,可在大型数据集上获得更好的性能:APPROX_COUNT_DISTINCTAPPROX_QUANTILESAPPROX_TOP_COUNTAPPROX_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;
编辑并运行代码