修改列名及注释
修改非分区表或分区表的列名或注释。
- 命令格式
alter table <table_name> change column <old_col_name> <new_col_name> <column_type> comment '<col_comment>'; - 参数说明
- table_name:必填。需要修改列名以及注释的表名称。
- old_col_name:必填。需要修改的列名称。
old_col_name必须是已存在的列。 - new_col_name:必填。新的列名称。表中不能有名为
new_col_name的列。 - column_type:必填。列的数据类型。
- col_comment:可选。修改后的注释信息。内容最长为1024字节。
- 使用示例
--修改表sale_detail的列名customer_name为customer_newname,注释“客户”为“customer”。 alter table sale_detail change column customer_name customer_newname STRING comment 'customer';
本文介绍如何通过SQL命令修改非分区表或分区表的列名及其注释信息。包括命令格式、参数说明及示例。
2456

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



