I know, we can not rename a column using modify column syntax
,but can change column syntax
.
My question is: what is the main usage of
The difference is whether you want to change the column name, column definition or both.
Can rename a column or change its definition, or both.
ALTER TABLE t1 CHANGE a b BIGINT NOT NULL
Can change a column definition but not its name
ALTER TABLE t1 MODIFY b INT NOT NULL
Can change a column name but not its definition.
ALTER TABLE t1 RENAME COLUMN b TO a
You can check the docs for the complete explanation.