본문 바로가기
SQL

[LeetCode] Trips and Users (date between)

by YGSEO 2021. 4. 10.
728x90
# Write your MySQL query statement below
select 
    Trips.Request_at as Day, 
    round(sum(if(status != 'completed',1,0)) / count(*), 2) as 'Cancellation Rate'
from
    Trips, Users
where
    Trips.Client_Id = Users.Users_Id and
    Users.Banned = "No" and
    Trips.Request_at BETWEEN '2013-10-01' and '2013-10-03'
group by
    Trips.Request_at

 

 

 

 

출처: tanwirkhan.medium.com/leet-code-262-trips-and-users-5899bf04ec0e

728x90

댓글