修改表名
指令:
HDFS中的表名也会被修改。
alter table test1(原表名) rename to test8(新表名);
增加/修改/替换列信息
修改列名:
指令:
alter table change id(原列名) stu_id(新列名) string(列的类型);
往表中添加列:
指令:
alter table test1 add columns (name string);
修改列名
指令:
alter table test1 replace columns(stu_id string,stu_name string);
replace是将原来表中的列名都进行替换。
比如原来有两个列分别是 id 和 name 但是在replace时只在括号中输入一个stu_id 那么执行完之后只剩下一个stu_id列。
这样虽然在显示的时候只会显示一个列的名字和信息,但是消失的列的信息不会消失,只是没有显示出来,当你加入新的列的时候信息会再显示出来。