SQL Help - **Newbie**

davebit

New Member
Joined
Oct 24, 2019
Messages
1
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!
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top