Alter Table - How to Add a column in a Table and How to Delete a column from a Table
The Alter Table statement is used to add, delete or modify the columns of an existing table. Sometimes we need to add a column into an existing table, delete a column from an existing table or modify the structure of the columns like data type, range etc into an existing table then the Alter Table statement is very useful.
Adding a Column into a Table:-
alter table <table_name> add <column_name datatype>
alter table student_info add (course varchar(30)
Deleting a Column from a Table:-
alter table <table_name> drop <column_name>
alter table student_info drop course
Modify a column into a Table:-
alter table <table_name> modify <column_name datatype>
alter table student_info modify (course varchar(50))
The Alter Table statement is used to add, delete or modify the columns of an existing table. Sometimes we need to add a column into an existing table, delete a column from an existing table or modify the structure of the columns like data type, range etc into an existing table then the Alter Table statement is very useful.
Adding a Column into a Table:-
alter table <table_name> add <column_name datatype>
alter table student_info add (course varchar(30)
Deleting a Column from a Table:-
alter table <table_name> drop <column_name>
alter table student_info drop course
Modify a column into a Table:-
alter table <table_name> modify <column_name datatype>
alter table student_info modify (course varchar(50))
{ 0 comments... read them below or add one }
Post a Comment