题解 | #平均活跃天数和月活人数#
平均活跃天数和月活人数
https://www.nowcoder.com/practice/9e2fb674b58b4f60ac765b7a37dde1b9
select DATE_FORMAT(submit_time,'%Y%m') as month ,round(count(DISTINCT uid,DATE_FORMAT(submit_time,'%Y%m%d'))/count(DISTINCT uid),2)as avg_active_days ,count(DISTINCT uid) as mau from exam_record where year(submit_time) = 2021 group by DATE_FORMAT(submit_time,'%Y%m')
又一次做到这道题,除了知识的综合使用。
这道题比较重要的就是 时间函数的应用,尤其是date_format的使用。