大資料實戰(五十二):電商數倉(三十五)之系統業務資料倉庫(八)GMV成交總額
阿新 • • 發佈:2020-08-23
1 ADS層
1.1 什麼是GMV
1.2建表語句
hive (gmall)> drop table if exists ads_gmv_sum_day; create external table ads_gmv_sum_day( `dt` string COMMENT '統計日期', `gmv_count` bigint COMMENT '當日gmv訂單個數', `gmv_amount` decimal(16,2) COMMENT '當日gmv訂單總金額', `gmv_payment` decimal(16,2) COMMENT '當日支付金額' ) COMMENTView Code'GMV' row format delimited fields terminated by '\t' location '/warehouse/gmall/ads/ads_gmv_sum_day/';
1.3資料匯入
-----------------------------需求 ads_gmv_sum_day-----------------------
統計每天的成交總額
-----------------------------相關表---------------------
dws_user_action
-----------------------------思路-----------------------
insert into table ads_gmv_sum_day
select
'2020-02-16',
sum(order_count) gmv_count,
sum(order_amount) gmv_amount,
sum(payment_amount) gmv_payment
from dws_user_action
where dt='2020-02-16'