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:
</>
Copy
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.
Now we shall rename the column section
to class
.
Let us verify the change with DESCRIBE TABLE query.