select a.user_id, min(a.date) as first_buy_date,min(a.next_date) as second_buy_date,count(*) as cnt
from
    (select
     * ,
     lead(date,1) over(partition by user_id order by date) as next_date
    from order_info
    where date>='2025-10-16'
      and status='completed'
      and product_name in('C++','Java','Python')
    ) a
group by a.user_id
having count(*)>=2
order by a.user_id ;