1.创建表:
>create table value_data(citing INT,cited INT)
>row format delimited
>fields terminated by ','
>stored as textfile;
2.查看新建的表:
>show tables;
3.查看新建表的结构:
>describe value_data;
4.加载本地数据到新表:
>load data local inpath '/usr/local/hadoop/data/value_data.txt'
>overwrite into table value_data;
5.查询前10行数据:
>select * from value_data limit 10;
6.查询该文件中存在多少条数据,这时hive将执行一个map-reduce的过程来计算该值:
>select count(1) from value_data;
7.删除新建的表:
>drop table value_data;
8.导出数据:
>/usr/local/hive/bin/hive -e "select * from value_data limit 10" >> res.csv