SQL ALTER TABLE Statement

The ALTER TABLE statement is used to:

SQL ALTER TABLE Syntax

To add a column in a table, the syntax is:
ALTER TABLE table_name
ADD column_name datatype
To delete a column in a table, use the following syntax (notice that some database systems don't allow deleting a column):
ALTER TABLE table_name
DROP(column name)
To change the data type of a column in a table, use the following syntax:
ALTER TABLE table_name
MODIFY COLUMN column_name datatype
Example
ALTER TABLE employee
ADD(city varchar2(100));
Here in employee table, we added new column that is city.
ALTER TABLE employee
Modify(city char(100));
Here we modified the city column in employee table.
Next, we want to delete the column named "name" in the "employee" table.
We use the following SQL statement:

ALTER TABLE employee
DROP(name)



  Tutorials

Popular Links

Contact Us

address Plot No-741,2ND Floor
Opp. Bhagabati Temple,Jayadev Vihar
      Bhubaneswar-751013
      Email: info@silantechnology.com
      Phone: 0674-2361252
address
39877, sundale dr, apt#101, Fremont, California 94538, USA
       Phone: +1(262)388-7619

facebook twitter google linked in

© 2018 Silan Technology. All Rights Reserved