How can multiple columns be added to a table in MySQL?

To add multiple fields to a table, you can use the ALTER TABLE statement, followed by the ADD keyword to specify the fields and their data types to be added.

For example, to add two fields, email and phone, to the users table, you can use the following statement:

ALTER TABLE users
ADD email VARCHAR(255),
ADD phone VARCHAR(20);

This will add two fields, email and phone, to the users table. They will be of type VARCHAR and have maximum lengths specified as 255 and 20 respectively. You can modify the data types and constraints of the fields as needed.

bannerAds