题解 | #牛客的课程订单分析(六)#

牛客的课程订单分析(六)

http://www.nowcoder.com/practice/c5736983c322483e9f269dd23bdf2f6f

知识点

  1. 窗口函数和之前一样的
  2. 因为客户端id可能没有出现null值所以连接时用左连接连接client表

代码

select t.id, t.is_group_buy, c.name as client_name
from (
    select id, is_group_buy, client_id, 
    count(*) over (partition by user_id) as cnt
    from order_info
    where date > '2025-10-15'
    and product_name in ('C++', 'Python', 'Java')
    and status = 'completed'
    ) as t
left join client as c 
on c.id = t.client_id
where t.cnt >= 2
order by t.id
全部评论

相关推荐

06-18 16:45
门头沟学院 Java
点赞 评论 收藏
分享
收到了小米的实习offer,犹豫是否要去。。。
认真搞学习:雷总还当过首富呢,公司不算大厂算独角兽吗
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务