题解 | #牛客的课程订单分析(四)#
牛客的课程订单分析(四)
https://www.nowcoder.com/practice/c93d2079282f4943a3771ca6fd081c23
select
distinct
user_id,
min(date) over(partition by user_id order by date) first_buy_date,
count(*) over(partition by user_id) cnt
from
(
select
*
from
(
select
*,
count(*) over(partition by user_id) num
from
(
select
*
from
order_info o
where
date > "2025-10-15" and
product_name in("C++","Java","Python") and
status = "completed"
) t
) t
where
num >= 2
) t
order by
user_id
distinct
user_id,
min(date) over(partition by user_id order by date) first_buy_date,
count(*) over(partition by user_id) cnt
from
(
select
*
from
(
select
*,
count(*) over(partition by user_id) num
from
(
select
*
from
order_info o
where
date > "2025-10-15" and
product_name in("C++","Java","Python") and
status = "completed"
) t
) t
where
num >= 2
) t
order by
user_id
查看13道真题和解析
