99999久久久久久亚洲,欧美人与禽猛交狂配,高清日韩av在线影院,一个人在线高清免费观看,啦啦啦在线视频免费观看www

熱線電話:13121318867

登錄
2023-07-20 閱讀量: 2545
Cda數(shù)據(jù)分析——Sql淘寶案例(六)消費(fèi)偏好分析

這個(gè)相對(duì)于留存分析等相對(duì)簡(jiǎn)單,附代碼

其中topn是常用的指標(biāo)分析,而第一段的having是為了防止分母為0,轉(zhuǎn)化率為null

# 查詢每個(gè)商品的瀏覽量、成交量、轉(zhuǎn)化率
select  item_id,
        sum(if(behavior_type='pv',1,0)) as 瀏覽量,
      sum(if(behavior_type='buy',1,0)) as 成交量,
     sum(if(behavior_type='buy',1,0))/sum(if(behavior_type='pv',1,0)) as 轉(zhuǎn)化率
from userbehavior_new
group by item_id
having sum(if(behavior_type='pv',1,0)) and sum(if(behavior_type='buy',1,0)) >0;
# 爆款商品:流量top10
select item_id,
       sum(if(behavior_type = 'pv',1,0)) as 流量,
       row_number()over(order by sum(if(behavior_type = 'pv',1,0)) desc) as 排名
from userbehavior_new
group by item_id;
# 暢銷商品:成交top10
select item_id,
       sum(if(behavior_type = 'buy',1,0)) as 流量,
       row_number()over(order by sum(if(behavior_type = 'buy',1,0)) desc) as 排名
from userbehavior_new
group by item_id;



0.0000
0
關(guān)注作者
收藏
評(píng)論(0)

發(fā)表評(píng)論