1.修改表名 (1)语法
ALTER TABLE table_name RENAME TO new_table_name(2)实操案例
hive (default)> alter table dept_partition2 rename to
dept_partition3;2.增加、修改、替换列信息 (1)语法 更新列
ALTER TABLE table_name CHANGE [COLUMN] col_old_name col_new_name
column_type [COMMENT col_comment] [FIRST|AFTER column_name]增加和替换列
ALTER TABLE table_name ADD|REPLACE COLUMNS (col_name data_type
[COMMENT col_comment], ...) 注:ADD 是代表新增一字段,字段位置在所有列后面(partition 列前),REPLACE 则是表示替换表中所有字段。 (2)实操案例 (1)添加列
hive (default)> alter table dept_partition add columns(deptdesc
string);(2)更新列
hive (default)> alter table dept_partition change column
deptdesc desc int;(3)替换列
hive (default)> alter table dept_partition replace
columns(deptno string, dname
string, loc string);