Home > DeveloperSection > Interviews > What is the use of Alter Table command in database?

Posted on    October-16-2010 12:00 AM

 MSSQL Server MSSQL Server 
Ratings:
 2 Answer(s)
  1052  View(s)
Rate this:

Pushpendra Singh

Total Post:241

Points:1205
Posted on    November-09-2010 1:00 AM

The ALTER table command is used to add, delete, or modify columns in an existing table.

To add a column in a table, use the following syntax:

ALTER TABLE table_name
ADD column_name datatype

Chris S
Chris S

Total Post:23

Points:115
Posted on    November-10-2010 1:00 AM

The SQL ALTER TABLE command is used to add, delete or modify columns in an existing table.

Use of ALTER command in database

Alter command is used for change the column name, add column, add constraint, and change the datatype.

Syntax: Add Column name

ALTER TABLE table_name
ADD column_name datatype

Syntax: Delete a Column

ALTER TABLE table_name
DROP COLUMN column_name

Syntax: Change Column Name

ALTER TABLE table_name
ALTER COLUMN column_name datatype


Modified On Mar-21-2016 06:47:35 AM

Don't want to miss updates? Please click the below button!

Follow MindStick