题解 | 每个商品的销售总额

每个商品的销售总额

https://www.nowcoder.com/practice/6d796e885ee44a9cb599f47b16a02ea4

select 
    name as product_name,
    sum(quantity) as total_sales,
    dense_rank() over(partition by category order by category asc, sum(quantity) desc, product_id asc) as category_rank
from orders
join products using (product_id)
group by name, category, product_id


全部评论

相关推荐

不愿透露姓名的神秘牛友
05-09 15:06
求好运眷顾🙏🏻:翻译:面试前没盘点好hc一下面太多了,现在在排序回去等通知
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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