Home Quartz SQL Alter Table Name

Related Tutorials


 
 

Share on Google+Share on Google+

SQL Alter Table Name

Advertisement
sql alter table

SQL Alter Table Name

     

SQL Alter Table Name is used to change or modify  name of the existing table. To understand how to change the name of created table in SQL Query, this tutorial brings you a simple example to understand it.

The Table 'Stu_Table' is created using create table statement. The insert into statement add records or rows to the table 'Stu_Table'. The inserted record from a table 'Stu_Table' is returned by the select statement. Now we want to change the name of Table 'Stu_Table' to 'Stu_Tab_10'. The Alter table Query will run ,which alter the name of existing table 'Stu_Table'. The Rename Query rename the Table 'Stu_Table' to 'Stu_Table_10'.Once the query is submitted, the successful Rename is displayed. 

Create Table Stu_Table

create table Stu_Table(Stu_Id integer(2), Stu_Name varchar(15), Stu_Class  varchar(10))

Insert data into Stu_Table

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

 Stu_Table

Stu_Id Stu_Name Stu_Class
1 Komal 10
2 Ajay 10
3 Rakesh 10
4 Bhanu 10
5 Santosh 10

SQL Alter Query

 

Alter table Stu_Table rename to Stu_Table_10)

Result

Successful Rename ...

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



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: April 18, 2011

Related Tutorials

Discuss: SQL Alter Table Name  

Post your Comment


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