Home Sql Mysql-table Mysql Add Column Number
Questions:Ask|Latest


 
 

Share on Google+Share on Google+

Mysql Add Column Number

Advertisement
Mysql Add Column Number is used to add the column to the existing table.

Mysql Add Column Number

     

Mysql Add Column Number is used to add the column to the existing table.

Understand with Example

The Tutorial illustrate an example from 'Mysql Add Column Number'.To understand and grasp this example we create a table 'Stu' with required fieldname and datatypes. 

 

 

 

Create Table Stu

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

Insert data into Stu

The 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 is used to modify the definition table 'stu' and add a column 'class' to the existing table. 

ALTER TABLE table_name
ADD column_name column-definition

SQL Add Column Query

Alter Table Stu add Class number(10);

Stu table

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

Liked it!  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.

Posted on: January 20, 2009

Ask Questions?    Discuss: Mysql Add Column Number   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
DMCA.com