CommencerCommencer gratuitement

Fonctions statistiques approximatives

GoogleSQL propose quatre fonctions d’agrégation approximatives qui offrent de meilleures performances sur de grands jeux de données : APPROX_COUNT_DISTINCT, APPROX_QUANTILES, APPROX_TOP_COUNT, APPROX_TOP_SUM. Dans cet exercice, vous allez exécuter la même requête en utilisant chacune de ces fonctions.

Cet exercice fait partie du cours

Introduction à BigQuery

Afficher le cours

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

-- 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;
Modifier et exécuter le code