Get startedGet started for free

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!

This exercise is part of the course

Data Types and Functions in Snowflake

View Course

Exercise instructions

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

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

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
___;
Edit and Run Code