Add a New Column

Learn to add a new column to an existing table.

So far, we’ve become familiar with different queries like insert, delete, update, and select. We’ve also used several operators for our different requirements. Now, we’ll learn to add a new column to an existing table. Let’s suppose that we want to introduce a column with the name identity. We assume that each customer has a unique identity number, and we want to introduce this concept to our data model.

The alter table command

We execute the following alter table command to add the column:

alter table customers add column(identity varchar(32) not null);

Before we actually execute that command, let’s explore the elements that are used to compose the command.

Parts of the alter table command

Get hands-on with 1200+ tech skills courses.