ALTER TABLE ADD Column
To add new column in existing table, ALTER TABLE is used with ADD action with following syntax
Syntax:
ALTER TABLE table_name ADD column_name data_type constraint;
In this statement:
- -First, you specify the name of the table, which you want to add the new column, after the ALTER TABLE clause.
- -Second, you specify the column name, data type, and its constraint.
Points to Remember:
- You cannot add a column that already exists in the table; trying to do so will cause an error.
- In addition, the ALTER TABLE ADD column statement adds the new column at the end of the table.
How to add multiple columns in the existing table
Syntax:
ALTER TABLE table_name ADD (column_name_1 data_type constraint, column_name_2 data_type constraint, ... column_name_n data_type constraint);
..