Hive应用实验-DDL常用命令

开启动态分区
set hive.exec.dynamic.partition=true;
set hive.exec.dynamic.partition.mode=nonstrict;

添加列
alter table employee add columns (yoj String);

查看表结构
describe employee;

加载数据
load data local inpath '/data/sample.txt' overwrite into table employee;

创建分区表
create table emp_part(eid int,ename string,salary string,node string)
partitioned by (yoj string)
row format delimited
fields terminated by '\t'
lines terminated by '\n';

加载分区数据
load data local inpath '/data/sample.txt' overwrite into table emp_part partition (yoj='2018');

创建动态分区表
--添加数据
insert into table emp_part partition (yoj)
select eid,name,salary,destination,yoj from employee;
分区字段必须是最后一个字段

查看分区
show partitions emp_part;

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 实验步骤 注意:由于数据库对大小写不敏感,因此大写和小写都可以使用。 1. HiveQL:数据操作 (1)进入Hi...
    d6a12a231881阅读 2,334评论 0 0
  • 1.进入hive数据库: hive 2.查看hive中的所有数据库:show databases; 3.用defa...
    小聪虫阅读 499评论 0 0
  • 一、创建表 创建新表hive> CREATE TABLE t_hive (a int, b int, c int)...
    BestFei阅读 3,453评论 0 2
  • 1、Hive表关联查询,如何解决数据倾斜的问题?(☆☆☆☆☆) 1)倾斜原因: map输出数据按key Hash的...
    陈二狗想吃肉阅读 263评论 0 0
  • 一、 DDL 操作 启动服务: (一)数据库操作 1. 创建数据库 默认:创建的数据库将放在hdfs:/user/...
    无剑_君阅读 455评论 0 0

友情链接更多精彩内容