Evaluating workout length
Personal trainers are looking to "right-size" the length of their classes by meeting their members where they're at. They'd like to better understand the average time that users spend in the gym for each workout type. This will help them determine the correct length for each class type.
Diese Übung ist Teil des Kurses
Data Types and Functions in Snowflake
Anleitung zur Übung
- Create a CTE called
workout_durations
that returns thegym_id
,workout_type
, and calculatedworkout_length
from theCORE_GYM.visits
table. - Pivot the results to create a result set that shows the average
workout_length
for each gym and workout type.
Interaktive Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
-- Create a CTE called workout_durations to prepare data to be pivoted
___ ___ ___ (
SELECT
gym_id,
workout_type,
DATEDIFF(MINUTES, checkin_time, checkout_time) AS workout_length
___ ___.___
)
SELECT
*
FROM workout_durations
-- Pivot the results, find the average workout length for each gym and workout type
___(
___(___)
___ ___ IN (ANY ORDER BY workout_type)
);