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

select
    a.emp_id as emp_id,
    emp_level,
    tag as exam_tag
from
    emp_info a,
    examination_info b,
    (
        select
            *,
            avg(timestampdiff (second, start_time, submit_time)) over (
                partition by
                    exam_id
            ) as avg_time,
            avg(score) over (
                partition by
                    exam_id
            ) as avg_score
        from
            exam_record
    ) c
where
    a.emp_id = c.emp_id
    and b.exam_id = c.exam_id
    and timestampdiff (second, start_time, submit_time) < avg_time
    and score > avg_score
    and emp_level < 7
group by
    b.exam_id,
    tag,
    a.emp_id
order by
    a.emp_id,
    b.exam_id

全部评论

相关推荐

06-11 13:34
门头沟学院 C++
offe从四面八方来:我真的没时间陪你闹了
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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