How can we add multiple columns, with single command, to an existing MySQL table?

MySQLMySQLi Database

We can also add multiple columns to an existing table with the help of ALTER command. The syntax for it would be as follows −


Alter table table-name ADD (column-name1 datatype, column-name2 datatype,… column-nameN datatype);


In the example below, with the help of ALTER Command, columns ‘Address’, ‘Phone’ and ‘Email’ are added to the table ‘Student’.

mysql> Alter Table Student ADD(Address Varchar(25), Phone INT, Email Varchar(20));
Query OK, 5 rows affected (0.38 sec)
Records: 5 Duplicates: 0 Warnings: 0
Updated on 20-Jun-2020 05:53:09