In this post we will see how we can rename column name in MySQL.
Using Rename keyword we can rename the column name in MySQL.
Syntax of renaming column name in MySQL
Alter table table_nm Rename Column column_name To new_column_name;
- Alter is used to modify the table
- Rename is used to rename the column
- Column_name is the existing column name.
- New_column_name is the new column name.
Example of renaming column name in MySQL
Let’s take an example to understand how to Rename column name in MySQL.
Alter table dept rename column owner to Dept_Owner;
Here column owner will be renamed to Dept_Owner.