修改列
新建表t_seq
hive> create table t_seq like test_1;

添加列
hive> alter table t_seq add columns(address string,age int);

全部替换
hive>alter table t_seq replace columns(id int,name string,address string,age int);
修改已经存在的列定义
hive> alter table t_seq change id uid string;

显示命令
show tables 显示表
show databases 显示库
show partitions 显示分区
show functions 显示hive中所有内置函数
desc 表名 显示表结构
desc extended 表名 显示表结构的详细信息
desc formatted 表名 格式化显示表结构的详细信息

清空数据保留表结构
truncate table 表名
插入数据
插入单条数据
hive> insert into t_seq values('10','mm','beijing',20);

将test_44表中staylong小于200的添加到day=lt200的分区中
hive> insert into table test_4_st_200 partition(day='lt200')
> select ip,url,staylong from test_44 where staylong<200;

这篇博客介绍了Hive中如何修改列、新建表、插入数据、使用SELECT进行各种类型的数据查询,以及JSON函数的解析,包括get_json_object方法和两种解析方式,最后提到了explode和lateral view在处理数据时的应用。
最低0.47元/天 解锁文章
3174

被折叠的 条评论
为什么被折叠?



