修改列
新建表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;