Here is the statement skeleton for adding new column in an existing table.
ALTER TABLE table_name
ADD column_name1 datatype
ADD column_name2 datatype
ADD column_name3 datatype
.................................................
.................................................
.................................................
ADD column_nameN datatype
Lets explain it using an example:
Lets suppose I have a table Student and I want to add new columns int it then I will write the query like this.
ALTER TABLE Student
ADD CourseName varchar(50)
ADD Address varchar(100)
ADD SemesterNo int
ADD PassingOutYear DateTime
So all these columns gets added to the table.
ALTER TABLE table_name
ADD column_name1 datatype
ADD column_name2 datatype
ADD column_name3 datatype
.................................................
.................................................
.................................................
ADD column_nameN datatype
Lets explain it using an example:
Lets suppose I have a table Student and I want to add new columns int it then I will write the query like this.
ALTER TABLE Student
ADD CourseName varchar(50)
ADD Address varchar(100)
ADD SemesterNo int
ADD PassingOutYear DateTime
So all these columns gets added to the table.
No comments:
Post a Comment