Don't Weight¶
You've created an app to help people lose weight called Don't Weight. You finally have some data on your pilot users, which you can view with the following query.
WITH
user_weights AS (
SELECT [175.1, 175.2, 173.8, 173.9, 174.5, 174.6] AS weights, "John" as user
UNION ALL SELECT [233.0, 230.4, 231.8, 1229.6, 230.0] as weights, "Ryan" as user
UNION ALL SELECT [165.5, 165.0] as weights, "Amber" as user
)
SELECT * FROM user_weights
Daily weights stored as arrays
Notice! Each user's sequence of weights are stored inside an array.
Each day, your user's must record their weight, as shown in the table above. For example, John weighed 175.1 lbs on the day he installed the app. Five days later (i.e. day 6), he weighed 174.6 lbs - a good sign!
For each user, calculate
- How much they weighed on day 1
- How much weight they lost between day 1 and day 2
- How much weight they lost between day 1 and day 3
- How much weight they lost between day 1 and their last day using the app.