题解 | 工作日各时段叫车量、等待接单时间和调度时间

工作日各时段叫车量、等待接单时间和调度时间

https://www.nowcoder.com/practice/34f88f6d6dc549f6bc732eb2128aa338

select period,count(1) get_car_num,round(avg(timestampdiff(second,event_time,end_time))/60,1) avg_wait_time,round(avg(timestampdiff(second,order_time,start_time))/60,1) avg_dispatch_time
from(
select event_time,end_time,order_time,start_time,finish_time,(case when time(event_time) >= '07:00:00' and time(event_time) < '09:00:00'
then '早高峰' when time(event_time) >= '09:00:00' and time(event_time) < '17:00:00'
then '工作时间' when time(event_time) >= '15:00:00' and time(event_time) < '20:00:00' then '晚高峰' when time(event_time) >= '20:00:00' or time(event_time) < '07:00:00'
then '休息时间' 
end) as period
from tb_get_car_record tgcr
join tb_get_car_order tgco
on tgcr.order_id = tgco.order_id
where date_format(date(event_time),'%w') between 1 and 5) as t1
group by period
order by get_car_num


全部评论

相关推荐

07-07 11:33
江南大学 Java
已经在暑假实习了&nbsp;,没有明确说有hc,纠结实习到八月份会不会有点影响秋招毕竟感觉今年好多提前批
程序员小白条:92的话准备提前批,其他没必要,没面试机会的,而且你要准备充分,尤其八股和算法题
点赞 评论 收藏
分享
屌丝逆袭咸鱼计划:心态摆好,man,晚点找早点找到最后都是为了提升自己好进正职,努力提升自己才是最关键的😤难道说现在找不到找的太晚了就炸了可以鸡鸡了吗😤早实习晚实习不都是为了以后多积累,大四学长有的秋招进的也不妨碍有的春招进,人生就这样
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务