시작하기무료로 시작하기

근사 통계 함수

GoogleSQL에는 대규모 데이터셋에서 더 나은 성능을 제공하는 네 가지 근사 집계 함수가 있습니다: APPROX_COUNT_DISTINCT, APPROX_QUANTILES, APPROX_TOP_COUNT, APPROX_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;
코드 편집 및 실행