Sometimes you will want to add a column after another column in mysql. To do this requires the alter table syntax, so be sure that the user you intend to use to alter table has alter privileges.
Here is an example of how one would use the alter command to do this
alter table test add column newcolumn varchar(255) after existingcolumn;
This command will alter some table named “test” and add a column called “newcolumn” AFTER a column “existingcolumn”. The “newcolumn” will also have a datatype of varchar.
Leave a Reply
You must be logged in to post a comment.