ComenzarEmpieza gratis

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.

Este ejercicio forma parte del curso

Introduction to BigQuery

Ver curso

Instrucciones del ejercicio

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

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

-- 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
___
Editar y ejecutar código