上传数据文件到HDFS
hdfs dfs -put data /tmp/运行hive命令,打开hive终端
https://cwiki.apache.org/confluence/display/Hive/LanguageManual建表
create table test_1 (id string, name string) ROW FORMAT DELIMITED FIELDS TERMINATED BY ‘,’;
上面建表语句的意思是:每一行以逗号’,’为分隔符,每行有两列,分别为id 和 nameload data inpath ‘/tmp/data’ into table test_1;
hive中常用命令:
1. show databases;
2. show tables;
3. use ‘database name’ //切换到某个数据库