select distinct a.user_id
from (
    select user_id,count(*) over(partition by user_id ) as num
    from order_info
    where date>'2025-10-15'
    and status ='completed'
    and (product_name ='C++' or product_name ='Java' or product_name ='Python')
)a
where a.num>=2
order by a.user_id

count(*) over(partition by user_id )实现计算每个用户的购买数量,限制条件用where实现;

外层查询实现限制课程数>=2