How do I change the order of my table fields without deleting the field and re-inserting it, using PHP myAdmin?
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
http://dev.mysql.com/doc/refman/5.0/en/change-column-order.html
From the Aforementioned Source:
If you decide to change the order of table columns anyway, you can do so as follows:
Create a new table with the columns in the new order.
Execute this statement:
mysql>
INSERT INTO new_table -> SELECT columns-in-new-order FROM old_table;
Drop or rename old_table.
Rename the new table to the original name:
mysql>
ALTER TABLE new_table RENAME old_table;
if you have MySQL Workbench you can easily reorder columns using mouse, graphically.
Just connect to your database, select your table and after right click, alter table and then drag columns to reorder them.
DATATYPE is something like DATETIME or VARCHAR(20) ..etc
Since version 4.0, phpMyAdmin has a "Move columns" dialog in Structure, that permits you to graphically move columns in the structure.
It's simple. Just go to PHPmyadmin, click on your database, then click table. Then click on structure. Below the table look for the button, "Move columns". Click and order the columns the way you want.