Results 1 to 6 of 6

Thread: insert into select statement for database

  1. #1
    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.

  2. #2
    Join Date
    Oct 2005
    Posts
    2,393

    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.

  3. #3
    Join Date
    May 2008
    Posts
    2,389

    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.

  4. #4
    Join Date
    Feb 2008
    Posts
    1,852

    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.

  5. #5
    Join Date
    Jan 2008
    Posts
    1,521

    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.

  6. #6
    Join Date
    Apr 2008
    Posts
    1,948

    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.

Similar Threads

  1. Connection and Statement objects in database connectivity
    By VAIJAYI in forum Software Development
    Replies: 5
    Last Post: 28-12-2010, 10:05 PM
  2. Replies: 1
    Last Post: 16-08-2010, 02:03 PM
  3. How to insert artificial data into a select statement?
    By MAHAH in forum Software Development
    Replies: 5
    Last Post: 12-03-2010, 09:03 PM
  4. Case statement in oracle database
    By Kingfisher in forum Software Development
    Replies: 4
    Last Post: 04-03-2010, 10:21 PM
  5. Use the CASE Statement in a SQL SELECT Clause
    By Abraham.J in forum Software Development
    Replies: 3
    Last Post: 12-08-2009, 01:52 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,589,773.22923 seconds with 17 queries