题解 | #计算用户的平均次日留存率#
计算用户的平均次日留存率
https://www.nowcoder.com/practice/126083961ae0415fbde061d7ebbde453
select count( a.device_id)/count( b.device_id) from (select distinct device_id,date from (select distinct device_id, date as date, lead(date) over (partition by device_id order by date) as date2 from question_practice_detail)k where date=date2-1 )a right join (select distinct device_id,date from question_practice_detail) b using(device_id,date)