稍微简洁一点

得分不小于平均分的最低分

https://www.nowcoder.com/practice/3de23f1204694e74b7deef08922805b2

select
    min(score) min_score_over_avg
from
    exam_record e
where
    score >= (
        select
            avg(e1.score)
        from
            exam_record e1
            inner join examination_info e2 on e1.exam_id = e2.exam_id
          and  e2.tag = 'SQL'
    )
    and exists(
        select * from examination_info where tag='SQL' and exam_id=e.exam_id
    )

全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务