HIve中case应用

示例数据:

ID 姓名  年龄  消费

id name age xf

101,zs,18,10045

102,ls,56,2222
103,ww,30,16666
104,zl,42,20000
105,tom,68,3000
106,jack,70,2000
107,amy,69,60000
108,lucy,12,200
109,frank,52,40000
111,mac,25,80000
112,ace,32,60000
113,tt,12,3000
114,hh,18,10000
115,haha,25,12000
116,hehe,19,1122
117,mm,20,56121
118,gg,36,222222
119,fuck,46,33333
121,hello,56,6558
122,goon,66,7000
123,soon,76,6666
124,good,86,5000
125,aa,96,100
126,kk,10,100


创建表格:

create table hehe(id int,name string ,age string,xf int) row format delimited fields terminated by ',' stored as textfile;

加载示例数据:

load data local inpath '/home/hadoop/hehe.txt' into table hehe;

1、统计各个年龄
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值