How to add columns in MySQL?

A column is a series of cells in a table that stores one value for each row in a table. We can add columns in an existing table using the ALTER TABLE statement as follows:

ALTER TABLE table_name
ADD COLUMN column_name column_definition [FIRST|AFTER existing_column];

To add columns to an existing table in MySQL, you can use the ALTER TABLE statement. Here’s the basic syntax:

ALTER TABLE table_name
ADD column_name column_definition;

Replace table_name with the name of the table to which you want to add the column, column_name with the name of the new column, and column_definition with the data type and any other attributes for the new column.

For example, if you want to add a new column named email of type VARCHAR(100) to a table named users, you would use:

ALTER TABLE users
ADD email VARCHAR(100);

You can also specify additional attributes like NOT NULL, DEFAULT, etc., as needed for your column definition.