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

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

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

select exam_id,
count(distinct uid) as uv, #去重
round(avg(score),1) as avg_score
from exam_record
left join user_info using(uid)
left join examination_info using(exam_id)
where tag = 'SQL' and level >5 and date_format(submit_time,'%Y%m%d') in (  #五级以上!不包括五
                                                select date_format(release_time,"%Y%m%d")
                                                from examination_info
                                                where tag = 'SQL')
group by exam_id
order by uv desc,avg_score asc

全部评论

相关推荐

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