大数据之Hive:DML数据操作(二)

数据导入(增)
3.查询语句中创建表并加载数据(As Select)

create table if not exists student3
as select id, name from student;

4.创建表时通过Location指定加载数据路径
1.上传数据到hdfs上

hive (default)> dfs -mkdir /student;
hive (default)> dfs -put /opt/module/datas/student.txt /student;

2.创建表,并指定在hdfs上的位置

hive (default)> create external table if not exists student5(
              id int, name string
              )
              row format delimited fields terminated by '\t'
              location '/student';

3.查询数据

hive (default)> select * from student5;

5 .Import数据到指定Hive表中
注意:先用export导出后,再将数据导入。

hive (default)> import table student2 partition(month='201709') from
 '/user/hive/warehouse/export/student';

6.Sqoop导入

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值