题解 | #某宝店铺动销率与售罄率#
某宝店铺动销率与售罄率
http://www.nowcoder.com/practice/715dd44c994f45cb871afa98f1b77538
- 这道题其实思想很简单,就是计算动销率和售罄率的公式理解了我好半天,题解排名第一的朋友讲解的很棒,有需要可以去看看!其他的就不多说啦!做法很常规
with t as(select
style_id,
tag_price,
inventory,
sales_num,
sales_price
from product_tb pt
left join sales_tb st
using(item_id))
select
style_id,
round((sum(sales_num)/(sum(distinct inventory)-sum(sales_num)))*100,2) as 'pin_rate(%)',
round((sum(sales_price)/sum(distinct tag_price*inventory))*100 ,2)as 'sell-through_rate(%)'
from t
group by style_id
order by style_id