题解 | #试卷发布当天作答人数和平均分#

试卷发布当天作答人数和平均分

https://www.nowcoder.com/practice/5b58e89556dc4153a79d8cf8c08ba499

子查询
select a.exam_id exam_id,count(distinct b.uid) uv,round(avg(b.score),1) avg_score
from examination_info a join exam_record b on a.exam_id=b.exam_id  and a.tag='SQL'
where b.uid in (select uid from user_info where level >5) and left(a.release_time,10)=left(b.start_time,10)
group by left(b.start_time,10),exam_id
order by uv desc , avg_score asc
联表
select a.exam_id exam_id,count(distinct b.uid) uv,round(avg(b.score),1) avg_score
from examination_info a join exam_record b on a.exam_id=b.exam_id and a.tag='SQL' and left(a.release_time,10)=left(b.start_time,10)
join user_info c on c.uid=b.uid and c.level>5
group by left(b.start_time,10),exam_id
order by uv desc , avg_score asc

全部评论

相关推荐

寿命齿轮:实习就一段还拉了,项目一看就不是手搓,学历也拉了,技术栈看着倒是挺好,就是不知道面试表现能咋样。 不过现在才大三,争取搞两端大厂实习,或者一个纯个人项目+一段大厂,感觉秋招还是未来可期。
投递美团等公司10个岗位
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务