Easily Reorder Table Columns in MySQL
You ever had problems arranging table in MySQL which has millions (or less) rows? I had a problem copying one table content to another, but that other one had same columns, but ordered differently. Then (in phpmyadmin) when do a copy, it does copying table1.col1 -> table2.col1 , table1.col2 -> table2.col2, etc. It doesn’t “recognize” mapping of the same columns, of course.
Just do this: (naturally, replace table’s and columns’ names, and varchar to int or whatever data type…)
ALTER TABLE table1 MODIFY column5 VARCHAR(255) AFTER column2
And you’ll be fine!
Share this story:
2 responses to “Easily Reorder Table Columns in MySQL”
Leave a Reply