题解 | 饿了么需要分析不同配送员在不同天气条件下的配送效率和用户投诉情况

饿了么需要分析不同配送员在不同天气条件下的配送效率和用户投诉情况

https://www.nowcoder.com/practice/e27ba25e7722478eb86c832fab96fc1a

with a as (
    select
        staff_id,
        avg(delivery_time) num,
        sum(is_complaint)/count(*) rate
    from
        delivery_records
    group by 
        staff_id
    having
        num > 20 and rate < 0.5
)
select
    weather_type,
    round(avg(delivery_time),2) average_delivery_time,
    count(*) delivery_count
from
    delivery_records t3
join
    delivery_staff t1 on t1.staff_id = t3.staff_id
join
    weather_conditions t2 on t2.weather_id = t3.weather_id
where
    t3.staff_id in (
        select staff_id from a
    )
group by 
    weather_type
order by 
    weather_type

全部评论

相关推荐

09-28 22:01
已编辑
广西科技大学 IT技术支持
合适才能收到offe...:找桌面运维?
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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