Skip to content

Commit dd4cb7f

Browse files
committed
Create trips-and-users.sql
1 parent 048c108 commit dd4cb7f

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

MySQL/trips-and-users.sql

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Time: O((t * u) + tlogt)
2+
# Space: O(t)
3+
4+
select
5+
t.Request_at Day,
6+
round(sum(case when t.Status like 'cancelled_%' then 1 else 0 end) / count(*), 2) Rate
7+
from Trips t
8+
inner join Users u
9+
on t.Client_Id = u.Users_Id and u.Banned='No'
10+
where t.Request_at between '2013-10-01' and '2013-10-03'
11+
group by t.Request_at

0 commit comments

Comments
 (0)