toggle menu

SQL ALTER TABLE Statement

Gaurav Thakur |20 Mar at 01:03

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

Following are the some Alter commands.

(1) To add a column in a table, use the following syntax:
ALTER TABLE table_name ADD column_name datatype;

(2) To delete a column in a table, use the following syntax;
ALTER TABLE table_name DROP COLUMN column_name;

(3) To change the data type of a column in a table, use the following syntax:
ALTER TABLE table_name MODIFY COLUMN column_name datatype;
 

  • 1 like
  • 1 comment

Gaurav Thakur21 Mar at 09:03

are these commands work on ORACLE database too ?

Posted:

20 Mar at 01:03

Viewed:

1708 times

Active:

23 Mar at 07:03