题解 | 统计加班员工占比

统计加班员工占比

https://www.nowcoder.com/practice/6c0a521c36e14c7599eaef858f6f8233

with
    t1 as (
        select
            at.staff_id,
            timestampdiff (second, first_clockin, last_clockin) / 3600 work_time,
            department
        from
            attendent_tb at
            left join staff_tb st on at.staff_id = st.staff_id
    )
select
    department,
    concat (
        round(
            sum(
                case
                    when work_time > 9.5 then 1
                    else 0
                end
            ) / count(staff_id) * 100,
            1
        ),
        '%'
    ) ratio
from
    t1
group by
    department
order by
    ratio desc

全部评论

相关推荐

不愿透露姓名的神秘牛友
06-23 18:30
美团优选内容调整,屁股都没离开座椅呢,多多买菜来挖了
熬夜脱发码农:哈,拼多多真挖人是吧
投递美团等公司10个岗位 >
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
06-26 14:50
人力小鱼姐:有后面墨迹那两句的时间问题早回答完了
点赞 评论 收藏
分享
白火同学:大二有这水平很牛了,可以适当对关键信息加粗一点,比如关键技术、性能指标之类的。
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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