大数据学习——hive数仓DML和DDL操作

回眸只為那壹抹淺笑 提交于 2020-11-14 01:40:51

1 创建一个分区表

create table t_partition001(ip string,duration int)
partitioned by(country string)
row format delimited
fields terminated by ',';

2 添加数据

load data local inpath '/root/hivedata/t_partitioned' into table t_partition001 partition(country="China");

 

3 增加一个分区

alter table t_partition001 add partition(country="Japan");

4添加数据

load data local inpath '/root/hivedata/t_partitioned' into table t_partition001 partition(country="Japan");

 

 5  show partitions t_partition001;

6删除分区

 alter table t_partition001 drop partition(country="Japan");

7修改表名

alter table t_partition001 rename to t_partition002;

8表增加一列

alter table t_partition002 add columns(city string);

 

9 替换表中所有字段

alter table t_partition002 replace columns(name string);

 

 10 更新某一列

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!