题解 | #得分不小于平均分的最低分#

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

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

select min(t1.score) as min_score_over_avg
from exam_record as t1 join examination_info as t2
on t1.exam_id=t2.exam_id
where t2.tag='SQL'  and t1.score>=
(select avg(score) FROM exam_record where exam_id in 
 (select exam_id FROM examination_info where tag="SQL" )
 )

知识点:子查询

这里用到了where后边+子查询的用法:

select * from t1 where cod>(select....)
select * from t1 where cod in (select....)

全部评论

相关推荐

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