I need to move the position of existing columns (for better visibility).
How can this be done without affecting the data?
Right-click the column and choose Move Up or Move Down .
An "ALTER TABLE ORDER BY" statement exist in the syntaxes accepted by MySQL. According to the documentation, this syntax: - only accept *one* column, as in "ALTER TABLE t ORDER BY col;" - is used to reorder physically the rows in a table, for optimizations.
Modify also works. Have a look:
ALTER TABLE foo MODIFY bar bartype AFTER baz;
The only way I know is to change the column. You would first extract your column definition using SHOW CREATE TABLE
and issue an ALTER TABLE
:
ALTER TABLE foo CHANGE COLUMN bar bar COLUMN_DEFINITION_HERE FIRST;
Or if you want it after a certain other column:
... AFTER OTHER_COLUMN;
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