示例数据:
ID 姓名 年龄 消费
id name age xf
101,zs,18,10045
102,ls,56,2222103,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、统计各个年龄