SQL Keyword - ADD

ADD Keyword

The ADD keyword or command is used to add a column to an existing table.

We have to create a table and then realize that we have to add more columns to the table.

So, using the Add keyword, we can add a new column in a table without affecting the existing data in the table.

Syntax

ALTER TABLE <TABLE_NAME> ADD <COLUMN_NAME> <DATATYPE>;

Example

ALTER TABLE Employee ADD Department Varchar(50);

In the above example Department column added to Employee table.

We can also add multiple columns using  ADD keyword.

Syntax

ALTER TABLE <TABLE_NAME> 
      ADD <COLUMN_NAME_1> <DATATYPE>,
      ADD <COLUMN_NAME_2> <DATATYPE>,
      ....
      ....
      ADD <COLUMN_NAME_N> <DATATYPE>;

Example

ALTER TABLE Employee 
      ADD Department Varchar(200),
      ADD Salary Integer;

In the above example Department and Salary column added to Employee table at a time.

Summary

ADD keyword is used to add a column to the existing table.

Next Recommended Reading Top Keyword in SQL