Javatpoint Logo
Javatpoint Logo


In this SQL article, you will learn about the ADD COLUMN command in detail with syntax and examples.

What is ADD COLUMN Statement?

In many SQL situations, you may require to add the new columns or fields in the existing table. So, SQL provides the ADD keyword with ALTER TABLE command to overcome this situation.

The ALTER TABLE and CREATE TABLE are the two different statements in Structured Query Language that allows you to add columns. But the difference between the both statements is that CREATE statement adds columns at the time of table creation, whereas ALTER statement adds one or more columns later in the existing table.

Syntax of ADD Column statement

This ALTER TABLE syntax allows us to add a single new field to the existing table.

If you want to add more than one new field to the table in a single SQL query, you have to use the following syntax:

Examples of ADD Column statement in SQL

Here, we took the following two different examples of Structured Query Language, which will help us to add single and multiple fields in the existing table:

Example 1:

Firstly, we create the Teacher_Details table and then insert the dummy records into the Teacher_Details table.

The following INSERT query inserts the record of teachers into the above table:

The following query displays the record of the Teacher_Details table:

Teacher_ID First_Name Course Teacher_Address Teacher_Age
2001 Arun MBA Goa 26
1002 Anita MCA Ghaziabad 25
1003 Vishal MBA Gorakhpur 24
1004 shobhit BCA Dehradun 26
1005 Rohit MCA Lucknow 28
1006 Yogesh MBA Jaipur 28

The following query adds the new Teacher_MailID column into the above Teacher_Details table:

Example 2:

Let's take another example which adds multiple columns into the table. Let's start by creating another Customer table:

The following query inserts the multiple records into the Customer table:

Cust_ID First_Name Gender City
501 Jones Male Goa
502 Arun Male Mumbai
503 Somya Female Shimla
504 Ajay Male Delhi
505 Ram Male Dehradun
506 Anaya Female Haridwar

Table: Customer

The following query adds two new columns in the Customer table:

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA