The ALTER TABLE statement is used to add, delete, or modify columns in an existing table. It is also used to add and drop various constraints on an existing table.
To add a new column to a table, use the following syntax:
ALTER TABLE table_name
ADD column_name datatype;
ALTER TABLE Customers ADD Email varchar(255);
To delete an existing column from a table, use the following syntax:
ALTER TABLE table_name
DROP COLUMN column_name;
The syntax to change the data type of a column varies between database systems.
ALTER TABLE table_name
ALTER COLUMN column_name new_datatype;
ALTER TABLE table_name
MODIFY COLUMN column_name new_datatype;