栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

hive对表的增删改查

hive对表的增删改查


前言

本文主要介绍hive中对表的改动基本内容




一、修改表

hive的使用中经常会有修改表的操作,本文简单的介绍hive表的修改




二、具体操作




1.重命名表
create table table_a(id int); //创建表table_a;
alter table table_a rename to table_b;//重命名table_a为table_b




2.更新修改列
alter table table_a change column id student_id int;//将列名id修改为student_id,类型不变
alter table table_a change column student_id student_id string;//不修改列名,仅修改列的类型为string
desc table_a;//查询表的结构信息
alter table table_a add columns(name string)//向table_a表中新增一列,列名为name,类型为string
alter table table_a change name name string first;//调整列name在最前面
alter table table_a change name name string after student_id;//将name更新到指定列的后面
alter table table_a replace columns(age int);//替换所有的列
drop table table_a;//删除表

本文总结的是hive中对表的基本操作,分区表跟桶下期再进行总结


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/680996.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号