• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
戈瑾
博客园    首页    新随笔    联系   管理    订阅  订阅
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%';

 

 

 

posted on 2021-10-11 15:52  戈瑾  阅读(253)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3