technology made simple.

Change Field Order in MySQL Table Structure using phpMyAdmin

October 19th, 2009 Posted in tech tips

Sometimes a database admin wants to change the order of fields in their table. I find it handy when I want SELECT * to return the fields in a particular order. While there are no buttons to change the field order, you can do it with a simple SQL statement. In the following example, I am changing the order of a field with the data type TINYTEXT, but it will work with any fieldtype:

ALTER TABLE `nameoftable` MODIFY COLUMN `columnname1` TINYTEXT AFTER `columnname2`;

Post a Comment