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

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

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

select er.exam_id as exam_id,count(distinct er.uid) as uv,round(avg(score),1) as avg_score
from user_info as uf
right join exam_record as er
on uf.uid=er.uid
left join examination_info as ei
on er.exam_id=ei.exam_id
where ei.tag='SQL' and level>'5' and date_format(submit_time,'yyyy-mm-dd')=date_format(release_time,"yyyy-mm-dd")
group by er.exam_id
order by uv desc,avg_score;

连表(拿到题目要做的事情),条件查询(题目要求),分组(不分组会报错,因为字段用了聚合函数),排序(题目要求),秒了

全部评论

相关推荐

双非坐过牢:非佬,可以啊10.28笔试,11.06评估11.11,11.12两面,11.19oc➕offer
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务