Hadoop-Hive基本使用

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qichangjian/article/details/88044330

Hive 基本使用

1、 创建库:create database if not exists mydb;
2、 查看库:show databases;
3、 切换数据库:use mydb;
4、 创建表:create table if not exists t_user(id string, name string)
或 create table t_user(id string, name string) row format delimited fields terminated by ‘,’;
5、 查看表列表:show tables;
6、 插入数据:insert into table t_user values (‘1’,‘huangbo’), (‘2’,‘xuzheng’), (‘3’,‘wangbaoqiang’);
7、 查询数据:select * from t_user;
8、 导入数据:
a) 导入 HDFS 数据:load data inpath ‘/user.txt’ into table t_user;
b) 导入本地数据:load data local inpath ‘/home/hadoop/user.txt’ into table t_user;
user.txt 的数据为:
4,liudehua
5,wuyanzu
6,liangchaowei
9、再次查询数据:select * from t_user;

猜你喜欢

转载自blog.csdn.net/qichangjian/article/details/88044330
今日推荐