题解 | #0级用户高难度试卷的平均用时和平均得分#
0级用户高难度试卷的平均用时和平均得分
https://www.nowcoder.com/practice/bb474c6cbd77478fb6d9fc86934d0ebb
select
uid,
round(avg(if(submit_time is not null,score,0))) avg_score,
round(avg(if(submit_time is not null,timestampdiff(minute,start_time,submit_time),duration)) ,1) avg_time_took
# round(sum(if(submit_time is not null,timestampdiff(second,start_time,submit_time)/60,60))/count(start_time),1) avg_time_took
from exam_record
left join examination_info using(exam_id)
left join user_info using(uid)
where level ='0' and difficulty='hard'
group by uid
having(count(start_time))>=1