#该题的重点在于计算不同用户月活天数的总和,会有天数重复,要用distinct函数划分时间。另外,注意是2021年数据
select date_format(start_time,"%Y%m") as month,
       round(count(distinct uid,date_format(start_time,"%Y%m%d"))/count(distinct uid),2) as avg_active_days, # 计算月活平均天数,
       count(distinct uid) as mau # 计算月活人数
from exam_record
where score is not null and year(start_time)=2021
group by month