Share on Google+Share on Google+

Mysql Add Column Number

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');


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



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: Mysql Add Column Number   View All Comments

Post your Comment

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