Hive数据分析(三)

数据分析处理

1、统计每天各个机场的销售数量和销售金额。

要求的输出字段

day_id,sale_nbr,,cnt,round

日期编号,卖出方代码,数量,金额

(1)、创建jichang表存放信息:

create table jichang(day_id string,sale_nbr string,cnt string,round string) row format delimited fields terminated by ',';


  

(2)、在表里插入数据:


 insert into table jichang select day_id,sale_nbr,sum(cnt) as cnt,sum(round) as round from sales_y group by sale_nbr,day_id having sale_nbr like 'C%';

2、统计每天各个代理商的销售数量和销售金额。

要求的输出字段

day_id,sale_nbr,,cnt,round

日期编号,卖出方代码,数量,金额

(1)、创建dailishang表存放信息:

create table dailishang(day_id string,sale_nbr string,cnt string,round string) row format delimited fields terminated by ',';

(2)、在表里插入数据:

insert into table dailishang select day_id,sale_nbr,sum(cnt) as cnt,sum(round) as round from sales_y group by sale_nbr,day_id having sale_nbr like 'O%';

原文地址:https://www.cnblogs.com/znjy/p/15380194.html