Hi ya'll - realizing this isn't an Excel question but hoping someone could help me interpret the output of the following SQL query and how it is structured.
Here is some information about the database:
- conversations_conversation records represent a single conversation between two people (owner and provider) on the platform.
- services_service records represent the descriptive values of services offered through the Rover platform. Providers can have multiple records if they offer more than one service. It has a one-to-many relationship with conversations_conversation
with
raw as(
select
service_type,
cc.start_date as convo_start,
cc.end_date as convo_end,
cc.booked_at as booked_date,
cc.cancelled_at as cancelled_date
from conversations_conversation cc
join services_service ss on cc.service_id = ss.id
),
agg as (
select
service_type,
min(julianday(convo_end) - julianday(convo_start)) as min_ttb,
round(avg(julianday(convo_end) - julianday(convo_start)), 1) as avg_ttb,
max(julianday(convo_end)-julianday(convo_start) as max_ttb
from raw
where
booked_date is not null
and cancelled_date is null
group by 1
having (julianday(convo_end) - julianday(convo_start))>= 1.0
)
select * from agg
union select '*min_vals*', min(min_ttb), min(avg_ttb), min(max_ttb) from agg
order by 3 desc, 1 desc
Thanks in advance for the help!
Here is some information about the database:
- conversations_conversation records represent a single conversation between two people (owner and provider) on the platform.
- services_service records represent the descriptive values of services offered through the Rover platform. Providers can have multiple records if they offer more than one service. It has a one-to-many relationship with conversations_conversation
with
raw as(
select
service_type,
cc.start_date as convo_start,
cc.end_date as convo_end,
cc.booked_at as booked_date,
cc.cancelled_at as cancelled_date
from conversations_conversation cc
join services_service ss on cc.service_id = ss.id
),
agg as (
select
service_type,
min(julianday(convo_end) - julianday(convo_start)) as min_ttb,
round(avg(julianday(convo_end) - julianday(convo_start)), 1) as avg_ttb,
max(julianday(convo_end)-julianday(convo_start) as max_ttb
from raw
where
booked_date is not null
and cancelled_date is null
group by 1
having (julianday(convo_end) - julianday(convo_start))>= 1.0
)
select * from agg
union select '*min_vals*', min(min_ttb), min(avg_ttb), min(max_ttb) from agg
order by 3 desc, 1 desc
Thanks in advance for the help!