LoslegenKostenlos loslegen

Filtering with HAVING

HAVING works exactly like a WHERE clause but it accepts aggregates as conditions. This helps filter your aggregated queries to find more specific trends.

Here you want to find all the product categories that have an average weight over a certain amount to find the categories that might incur higher shipping costs due to weight.

Diese Übung ist Teil des Kurses

Introduction to BigQuery

Kurs anzeigen

Anleitung zur Übung

  • Complete the query by finding the average product weight (product_weight_g), grouped by the product category (product_category_name_english) from the ecommerce.ecomm_products table.
  • Use HAVING to find product categories with an average weight over 10,000 grams.

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

-- Write a query that finds all product categories and their average weight with an average weight over 10,000 grams

SELECT
	-- Add the product_category_name_english column and the average weight
    ___
FROM ecommerce.ecomm_products
-- Add the GROUP BY statement
___
-- Add the HAVING condition on the average weight aggregate
___
Code bearbeiten und ausführen