hive创建表

1.要注意;user是一个关键字,不能普通的使用;不能直接将其作为表名,列名;

如果需要使用user ,应该这样:`user`          是tab键上面的一个按键。

犯下的错误:

hive创建表

2.hive建表语句:

建表字段:username string,month string,invit int。表名:student

语句:create table student(username string,month string,invit int) row format delimited fields terminated by '\t';

3.数据导入到表student中

语句:load data local inpath '/home/cry/student.txt' into table student;

4.student.txt  数据内容:

A 2015-01 5
A 2015-01 15
B 2015-01 5
A 2015-01 8
B 2015-01 25
A 2015-01 5
A 2015-02 4
A 2015-02 6
B 2015-02 10
B 2015-02 5
A 2015-03 16
A 2015-03 22
B 2015-03 23
B 2015-03 10

B 2015-03 11