- Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy path_1435.sql
14 lines (13 loc) · 536 Bytes
/
_1435.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
-- # Write your MySQL query statement below
with groupedBy as (
select"[0-5>"as bin, 0as minDuration, 60*5as maxDuration
union all
select"[5-10>"as bin, 60*5as minDuration, 60*10as maxDuration
union all
select"[10-15>"as bin, 60*10as minDuration, 60*15as maxDuration
union all
select"15 or more"as bin, 60*15as minDuration, 2147483647as maxDuration
)
select bin, count(session_id) as total from groupedBy
left join Sessions on duration >= minDuration and duration < maxDuration
group by bin;