Last updated on March 1st, 2022 at 09:02 am
This query will show you how to insert a new column after a specific column in mysql.
For example :- To insert the new column after a specific column, such as name, use this statement:
ALTER TABLE contacts ADD email VARCHAR(60) AFTER name;
If you want the new column to be first, use this statement:
ALTER TABLE contacts ADD email VARCHAR(60) FIRST;
Is it possible to add multiple columns after a specific existent column using one query?
Say you want to add the columns ’email’ and ‘telephone’ after the column ‘name’..
Yes it is possible,
Try this [mysql]ALTER TABLE my_table
ADD COLUMN col_1 date,
ADD COLUMN col_2 date,
ADD COLUMN col_3 date;[/mysql]