The ALTER TABLE ... RENAME COLUMN command is used to change the column name.
ALTER TABLE tableName RENAME COLUMN old_columnName TO new_columnName
Parameter |
Description |
---|---|
tableName |
Table name. |
old_columnName |
Old column name. |
new_columnName |
New column name. |
ALTER TABLE table1 RENAME COLUMN a.b.c TO x
a.b.c indicates the full path of a nested column. For details about the nested column rules, see Adding a Column.
After the column name is changed, the change is automatically synchronized to the column comment. The comment is in rename oldName to newName format.
You can run the DESCRIBE command to view the new column name.