Making appointments
Sometimes, a gym member will have a visit with a personal trainer. These visits must be booked in advanced to make sure a specific trainer is available. At the end of a visit with a trainer, the gym's "welcome team" will work with the member to set up another appointment, and you'd like to make their lives a little easier by suggesting next-appointment times.
This exercise is part of the course
Data Types and Functions in Snowflake
Exercise instructions
- Create a new column called
in_one_week
that proposes a next-appointment with a trainer in one week from thecheckin_time
TIMESTAMP
. - Repeat the first step, but this time, for an appointment in two weeks from the
checkin_time
. - Define one last column that proposes a next-appointment in one month from the
checkin_time
, and name the columnin_one_month
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
SELECT
m.personal_info:name.first AS first_name,
m.personal_info:name.last AS last_name,
v.gym_id,
v.checkin_time AS last_appointment,
-- Propose a next appointment in one week
___(___, ___, ___) AS ___,
-- Propose a next appointment in two weeks
___ AS in_2_weeks,
-- Propose a next appointment in one month
___
FROM CORE_GYM.visits AS v
JOIN CORE_GYM.members AS m
ON v.user_id = m.user_id;