Italian Trulli

SQL Alter Table With Example

Test Tribe
.
ALTER Table Query - How to Alter Table in SQL?


Alter table in SQL with Example

IN SQL ALTER TABLE statement is used to add, delete, or modify columns in an existing table.
ALTER TABLE statement is also used to add and drop various constraints on an existing table.

The ALTER statement in SQL  is always used with "ADD", "DROP" and "MODIFY"


 ALTER TABLE - ADD Column in the table

ALTER TABLE table_name ADD column_name datatype;

Example
ALTER TABLE Customers ADD Email varchar(25);


ALTER TABLE - DROP Column in table

ALTER TABLE table_name DROP COLUMN column_name;

Example

ALTER TABLE Customers DROP COLUMN Email; 

ALTER TABLE - ALTER/MODIFY  column in table 

ALTER TABLE table_name MODIFY COLUMN column_name datatype;

Post a Comment

0 Comments