rlb.usa
rlb.usa

Reputation: 15043

How do I reorder columns in MySQL Query Editor?

I want to move column OtherSupport below Amount2 ... is there an easy way to do this?

MySQL Query Editor

Upvotes: 2

Views: 3700

Answers (3)

MindStalker
MindStalker

Reputation: 14864

ALTER TABLE myTable MODIFY OtherSupport VARCHAR(50) AFTER Amount2;

Upvotes: 7

zahid9i
zahid9i

Reputation: 596

Here I have a general solution for mysql by sql query

ALTER TABLE table_name MODIFY COLUMN misplaced_column Column-definition AFTER other_column; Here in Column-definition is full column definition. To see the column definition if you are using phpmyadmin click on structure tab. Then click on change link on desired column. Then withour modifyig any things click save. It will show you the sql. Copy the sql and just add *AFTER other_column* at the end. It will be all.

If you like to bring the *misplaced_column* to the first position then ALTER TABLE table_name MODIFY COLUMN misplaced_column Column-definition FIRST;

Upvotes: 3

Mark Byers
Mark Byers

Reputation: 838226

You're not the first one to ask. Here's the feature request.

Either do it using SQL or use MySQL Workbench.

Upvotes: 4

Related Questions