When working with several RDBMSs, even minor changes in syntax can cause difficulties. This is the first in a series of postings about how to add multiple columns to various RDBMSs. This tutorial, on the other hand, will cover MySQL syntax, including not only how to add multiple columns but also how to place them between the required columns.
ALTER TABLE tableName
ADD COLUMN `column1` dataType ColumnPosition,
ADD COLUMN `column2` dataType ColumnPosition,
ADD COLUMN `column3` dataType ColumnPosition;
ALTER TABLE Customers
ADD COLUMN `CxID` SMALLINT(6) NOT NULL FIRST,
ADD COLUMN `LastName` VARCHAR(20) AFTER ‘FirstName’,
ADD COLUMN `status` INT(10) UNSIGNED NOT NULL AFTER `UpdateTime`;
Hope you find this article helpful.
Please subscribe for more interesting updates.