I want to change the column positions of my database table without losing data.
For example:
Current table:
+----+------+-------+----------+ | id | name | email | password | +----+------+-------+----------+
to
+----+----------+------+-------+ | id | password | name | email | +----+----------+------+-------+
Go to Structure and click Move Columns and then just drag the columns to rearrange.
Try this:
ALTER TABLE table_name MODIFY password varchar(20) AFTER id
Hearaman's answer is correct; but if you are using phpMyAdmin, there is a visual and practical way to do that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With