Share on Google+Share on Google+

SQL Add Column Int

Advertisement
The Tutorial covers on 'SQL Add Column Int'.To understand and grasp the example we create a table 'Stu' with required fieldnames and datatypes respectively.

SQL Add Column Int

     

SQL Add Column Int modifies the definition of table and add a new column to the existing table.

Understand with Example

The Tutorial covers on 'SQL Add Column Int'.To understand and grasp the example we create a table 'Stu' with required fieldnames and datatypes respectively.

 

 

 

 

Create Table Stu

create table Stu(Id integer(2), Name varchar(15));

Insert data into Stu

Insert into adds the records or rows to the table Stu.

insert into Stu values(1,'Komal');
insert into Stu values(2,'Ajay');
insert into Stu values(3,'Rakesh');
insert into Stu values(4,'Bhanu');
insert into Stu values(5,'Santosh');

 Stu

Id Name
1 Komal
2 Ajay
3 Rakesh
4 Bhanu
5 Santosh

SQL Add Column Syntax

The Alter Column is used to modify the table definition and add a new column 'class' to the existing table. 

ALTER TABLE table_name
ADD column_name column-definition

SQL Add Column Query

Alter Table Stu add Class int(10);

Stu table

Id Name Class
1 Komal NULL
2 Ajay NULL
3 Rakesh NULL
4 Bhanu NULL
5 Santosh NULL

 

Advertisements

Posted on: January 20, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Discuss: SQL Add Column Int  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0