Ever use something like phpMyAdmin? Ever add and/or remove some columns to a table, but then realize that the order of the columns aren’t really the way you’d like them?
This has bothered me ever since I started using phpMyAdmin. To the best of my knowledge there isn’t a way to fix this from within the software. However, it’s quite trivial to do it via regular SQL:
ALTER table `table_name`
MODIFY COLUMN `column_name` your_data_type
And by golly it works!
Found at Treble Click: Reorder mysql table columns via a Google search.
One thought on “Reorder Mysql Table Columns”
Nice tip! I’ve always struggled with the same thing. I hate when columns aren’t in the right order.
Anyway, thought I’d also mention a Mac OS X MySQL tool called Querious ($25), which I’m really liking as a replacement for phpMyAdmin. It lets you drag & drop columns, inline rename columns and data, open multiple tabs of databases, etc. Very slick. Highly recommended.