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

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

5K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started