题解 | #牛客的课程订单分析(六)#
牛客的课程订单分析(六)
http://www.nowcoder.com/practice/c5736983c322483e9f269dd23bdf2f6f
select b.id, is_group_buy,
(case when is_group_buy = 'Yes' then 'None'
when is_group_buy ='No' then name end) as client
from client
right outer join
(select id, client_id, count(1) over (partition by user_id) as cnt, is_group_buy
from order_info
where date > '2025-10-15'
and status = 'completed'
and product_name in ('C++','Python','Java')) as b
on client.id = b.client_id
where cnt >= 2
order by b.id;
这几道题都是技巧类,掌握窗口函数,的确可以省下很多的麻烦事。
MySQL试题答案解析 文章被收录于专栏
MySQL在线编程重点试题解析
嘉士伯公司氛围 714人发布