Sometimes it happens that once you created the MySQL table, later on, you need to arrange the column position or order according to the new updates.
There are two ways to change the table’s column order or position for your MySQL database:
- MySQL Query: You can do write the following SQL query to re-arrange the column
ALTER TABLE table_name MODIFY columnName ColumnType AFTER AfterColumnName
Example:
ALTER TABLE reviews MODIFY country varchar(50) AFTER state - Use the Drag and Drop method to do the changes, which allows you to do such changes in a visual practica way.
– Open the table you want to change the column order
– Click on the “Structure” tab (Second Tab)
– Bottom of the page you can find the link “Move columns”, click on that.
– Now, it will show you all columns’ names in a single row. You can Drag and drop column names and re-arrange them.