题解 | 完成员工考核试卷突出的非领导员工

完成员工考核试卷突出的非领导员工

https://www.nowcoder.com/practice/422dcd6ae72c49c9bbec1aff90d69806

select
    emp_id,
    emp_level,
    exam_tag
from
    (
        SELECT
            emp_id,
            emp_level,
            exam_id,
            tag exam_tag
        from
            (
                SELECT
                    emp_id,
                    emp_level,
                    exam_id,
                    score,
                    tag,
                    考试分钟,
                    avg(考试分钟) over (
                        partition by
                            tag
                    ) as 同类平均考试分钟,
                    avg(score) over (
                        partition by
                            tag
                    ) 同类平均分数
                from
                    (
                        select
                            A.emp_id,
                            A.exam_id,
                            A.score,
                            B.tag,
                            timestampdiff(minute, start_time, submit_time) as 考试分钟,
                            C.emp_level
                        from
                            exam_record A
                            left join examination_info B ON A.exam_id = B.exam_id
                            left join emp_info C ON A.emp_id = C.emp_id
                    ) as A
            ) as A
        where
            考试分钟 < 同类平均考试分钟
            and score > 同类平均分数
            and emp_level < 7
        order by
            emp_id asc,
            exam_id asc
    ) as A

全部评论

相关推荐

哈哈哈,你是老六:百度去年裁员分评不好,赶紧弄点红包
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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