select date_format(in_time, '%Y-%m-%d') as dt,
     round(sum(timestampdiff(second,in_time,out_time))/count(distinct uid), 1) avg_viiew_len_sec
from tb_user_log
where date_format(in_time, '%Y-%m') = '2021-11' and artical_id != 0
group by dt
order by avg_viiew_len_sec

题不难,但是有很多细节问题要注意,比如 artical_id != 0,这里需要注意到读者在非文章内容页(比如App内的列表页、活动页等),这种数据就应该去掉
其次 date_format(in_time, '%Y-%m') = '2021-11' ,不能只写year(in_time) = 2021,因为要统计的是11月份的
最后 count(distinct uid) 要给uid去重