9.ARPU2 - Providing help


#1

https://www.codecademy.com/courses/sql-analyzing-business-metrics/lessons/common-metrics/exercises/arpu-iii

I noticed a lot of people were having issues with 9. ARPU2. Even when I click "give me the code" after a bunch of failed tries, I was still told my code was wrong. I wanted to provide the answers that worked for me.


PART 1:

with daily_revenue as (
  select
    date(created_at) as dt,
    round(sum(price), 2) as rev
  from purchases
  where refunded_at is null
  group by 1
), 
daily_players as (
  select
    date(created_at) as dt,
    count(distinct user_id) as players
  from gameplays
  group by 1
)
select * from daily_players order by dt;

PART 2: Just copy and paste this over the entire code to prevent any confusion.

with daily_revenue as (
  select
    date(created_at) as dt,
    round(sum(price), 2) as rev
  from purchases
  where refunded_at is null
  group by 1
), 
daily_players as (
  select
    date(created_at) as dt,
    count(distinct user_id) as players
  from gameplays
  group by 1
)
select
  daily_revenue.dt,
  daily_revenue.rev / daily_players.players
from daily_revenue
  join daily_players using (dt);


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.