select avg(di) from (select diff,case diff when 1 then 1 else 0 end di from (select datediff(da,date) diff from ( select distinct device_id,date,lead(date,1) over(partition by device_id order by date) da from ( select distinct device_id,date from question_practice...