Ungefähre statistische Funktionen
GoogleSQL bietet vier verschiedene ungefähre Aggregatsfunktionen, die bei großen Datensätzen eine bessere Performance liefern: APPROX_COUNT_DISTINCT, APPROX_QUANTILES, APPROX_TOP_COUNT, APPROX_TOP_SUM. In dieser Übung führst du dieselbe Abfrage nacheinander mit jeder dieser Funktionen aus.
Diese Übung ist Teil des Kurses
<Kurs>Einführung in BigQuery</Kurs>Interaktive praktische Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
-- 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;