ComeçarComece de graça

What burns more calories?

You're interesting in uncovering a bit of high-level information around workouts. Values like the total and average number of calories burned could provide insight to gym members who are looking to get the most out of their workouts. Luckily, you have the tools to do so!

Este exercício faz parte do curso

Data Types and Functions in Snowflake

Ver curso

Instruções do exercício

  • Find the total sum of calories_burned for each workout_type.
  • Define a new column that stores the average number of calories_burned for each workout_type.
  • Create a column that stores the average number of calories_burned, rounded to two decimal places.
  • Aggregate the records by workout_type to ensure an error is not thrown.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

SELECT
    workout_type,
    
    -- Find the total number of calories burned
    ___ AS total_calories_burned,
    
    -- Store the average calories burned
    ___ AS avg_calories_burned,
    
    -- Round the average calories burned to 2 decimal points
    ___(___, ___) AS rounded_avg_calories_burned
    
FROM CORE_GYM.visits

-- Aggregate records by workout_type
___;
Editar e executar o código