Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



insert into select statement for database

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 09-03-2010
Member
 
Join Date: Oct 2009
Posts: 38
insert into select statement for database
  

Hello guys !
I have created a table and insert a lot of records as the name of students of my college.The table is created with address age and blah columns.The Address field is much big.The problem is that I need to create another table which requires the same information to feed.Should I insert the whole record again in the second or any thing else.If you have any idea about the tools or commands Then suggest me .

thanks.

Reply With Quote
  #2  
Old 09-03-2010
Member
 
Join Date: Oct 2005
Posts: 2,389
insert into select statement for database

Hello friend !

You have created a table but in which database you didn't specified.You have created another table that need the same information to insert.

There is no any tool and anything required to send your data from one table to another table .Commonly,In every database the insert into select statement is used to transfer the records from one table to another.

Before inserting the same records in second table,The datatypes and columns should be same as first table.Then after you can execute the query to insert the records in second table with appropriate arguments.
Reply With Quote
  #3  
Old 09-03-2010
Member
 
Join Date: May 2008
Posts: 2,383
insert into select statement for database

The already created table named Colg_record has some columns named
Name varchar(25)
Age number(5)
Address varchar(120)


Create another table named tab_dup but should be same data type.After creating the table tab_dup,you can execute the following query statement to perform the insert operation for second table.

Code:
insert into tab_dup(name,age,address) select * from colg_record;
The whole table data would be transferred to the newly created table.
__________________
The FIFA Manager 2009 PC Game
Reply With Quote
  #4  
Old 09-03-2010
Member
 
Join Date: Feb 2008
Posts: 1,845
Combine Multiple Tables into One in PHP

You can combine multiple tables in one table in MySQL database to use the insert into select statement .

Suppose, when you require to combine a number of tables into one. you need just certain fields and columns from each of the table and then would adjust them together into a newly created table.

Code:
INSERT INTO Par_tab1 SELECT tab1.col1, tab1.col3, tab2.col2, tab2.col6 FROM tab1, tab2
The above code can be used in a PHP script to perform the same.
Reply With Quote
  #5  
Old 09-03-2010
Member
 
Join Date: Jan 2008
Posts: 1,515
CREATE TABLE with SELECT statement in database

The SELECT statement can also be used create the table.Using the select statement,you can create another table which would be the clone of the back created table.It is commonly used to generate the reports from existing tables or performing the mixture.

The below expanded statement can be used to create another table using SELECT statement.The code would be as follows -

Code:
CREATE TABLE bbb SELECT col1, col2 FROM aaa;
Using the same way,you can create a table which would be the combination of more than one tables or tables column combination.
Reply With Quote
  #6  
Old 09-03-2010
Member
 
Join Date: Apr 2008
Posts: 1,947
insert into select statement for database

The capability of the insert into select statement has increased according to the version evolutions.Not only MySQL,there are so many databases which uses this statement grown their capability of MySQL statement.

You can investigate it from the official websites of the databases using the documentation articles written by experts of database.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "insert into select statement for database"
Thread Thread Starter Forum Replies Last Post
Connection and Statement objects in database connectivity VAIJAYI Software Development 5 28-12-2010 09:05 PM
Store procedure with 10 select statement.how to create datatable in dotnet? itechsasi Software Development 1 16-08-2010 02:03 PM
How to insert artificial data into a select statement? MAHAH Software Development 5 12-03-2010 08:03 PM
Case statement in oracle database Kingfisher Software Development 4 04-03-2010 09:21 PM
Use the CASE Statement in a SQL SELECT Clause Abraham.J Software Development 3 12-08-2009 01:52 PM


All times are GMT +5.5. The time now is 03:21 PM.