7.2 ADS層(每日新增設備表)
1)建表語句
hive (gmall)>
drop table if exists ads_user_retention_day_rate;
create external table ads_new_mid_count
(
create_date
string comment ‘創建時間’ ,
new_mid_count
BIGINT comment ‘新增設備數量’
) COMMENT ‘每日新增設備信息數量’
row format delimited fields terminated by ‘\t’
location ‘/warehouse/gmall/ads/ads_new_mid_count/’;
2)導入數據
hive (gmall)>
insert into table ads_new_mid_count
select
create_date,
count(*)
from dws_new_mid_day
where create_date=‘2019-02-10’
group by create_date;
3)查詢導入數據
hive (gmall)> select * from ads_new_mid_count;