题解 | #某宝店铺动销率与售罄率#

某宝店铺动销率与售罄率

https://www.nowcoder.com/practice/715dd44c994f45cb871afa98f1b77538

# 动销率=每个货号已经销售的数量/(库存-已经销售的数量)
# 售罄率 = GMV(即总销售额)/(吊牌价*库存数量)
with t1 as (
    select item_id, sum(sales_num) as sales_num, sum(sales_price) as gmv
    from sales_tb
    group by item_id
),
t2 as (
    select style_id, sum(tag_price*inventory) as fenmu, sum(inventory) as total_num
    from product_tb
    group by style_id
),
t3 as (
    select a.style_id, sum(b.sales_num) as sale_num, sum(b.gmv) as total_gmv
    from product_tb as a
    right join t1 as b
    on a.item_id = b.item_id
    group by a.style_id
)
select t2.style_id, 
ROUND(t3.sale_num/(t2.total_num-t3.sale_num)*100, 2) as pin_rate,
ROUND(t3.total_gmv/t2.fenmu*100 ,2) as sell_through_rate
from t2
left join t3
on t2.style_id = t3.style_id
order by t2.style_id;

全部评论

相关推荐

03-26 22:55
门头沟学院 Java
烤冷面在迎接:河南byd,应该就是郑大了。不过24届计算机是特殊情况,那年除了九✌和强2,以及两三个关系够硬的双非,其他的都是炮灰,感觉是十几年来互联网行业最烂的一年,如果想了解最新的就业情况,得找现在的大四。
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务