题解 | #重点:窗口函数:查用户刷题日期和下一次刷题日期#
查询用户刷题日期和下一次刷题日期
https://www.nowcoder.com/practice/fed7ebf4254240fdb6a2c963996ee8ff
select
a.`user_id`,
a.`date`,
a.`nextdate`
from
(
select
`user_id`,
`date`,
(
lead (`date`, 1) over (
partition by
`user_id`
order by
`date` asc
)
) as `nextdate`
from
questions_pass_record
) as a
order by
a.`user_id`,
a.`date`
