MySQL – Rename Column

It is quite often that you create a table with some column names and then because of some Change Requests in the project or some other reasons, you may have to change the column name. In this MySQL Tutorial, we shall learn to rename a column of MySQL Table.

To rename a column in MySQL, use the following syntax:

ALTER TABLE table_name CHANGE old_column_name new_column_name datatype(length);

Example 1 – Rename/change Column Name in MySQL Table

Let us consider a table called students whose schema is given below.

ADVERTISEMENT
MySQL Describe Table

Now we shall rename the column section to class.

MySQL Change Column Name

Let us verify the change with DESCRIBE TABLE query.

MySQL Describe table after changing column name