Aan de slagBegin gratis

Benaderende statistische functies

GoogleSQL biedt vier verschillende benaderende aggregatiefuncties die betere prestaties leveren op grote gegevenssets: APPROX_COUNT_DISTINCT, APPROX_QUANTILES, APPROX_TOP_COUNT, APPROX_TOP_SUM. In deze oefening doorloop je dezelfde query met elke functie.

Deze oefening maakt deel uit van de cursus

Introductie tot BigQuery

Bekijk cursus

Interactieve oefening met praktijkervaring

Probeer deze oefening door deze voorbeeldcode aan te vullen.

-- 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;
Code bewerken en uitvoeren