CommencezCommencez gratuitement

Fonctions statistiques approximatives

GoogleSQL offre quatre fonctions d'agrégation approximatives qui améliorent le rendement sur de grands ensembles de données : APPROX_COUNT_DISTINCT, APPROX_QUANTILES, APPROX_TOP_COUNT, APPROX_TOP_SUM. Dans cet exercice, vous exécuterez la même requête avec chacune de ces fonctions.

Cette activité fait partie du cours

Introduction à BigQuery

Voir le cours

Exercice interactif pratique

Essayez cet exercice en complétant ce code d’exemple.

-- 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