Share on Google+Share on Google+

Java Coder
MySQLselect into new table Example code
1 Answer(s)      2 years and 9 months ago
Posted in : SQL

Hi,

I have a big table in MySQL database and I want to create a new table with all the data in it. I have heard that there is SQL statement "mysql select into new table" which selects the data from one table and create and insert data into new table. What is the correct statement for selecting the records from one table and creating and inserting the data into another table?

Thanks

Ads

View Answers

July 9, 2014 at 3:24 PM


Hi,

Hi suppose you have a table1 and you want to save all the records from table1 into another table. Then follow the steps given below:

First of create a table table2 with the same structure as table1.

Now run the following statement:

insert INTO table2 SELECT * from table1;

Above sql statement will insert all the data from table1 into table2.

Thanks










Related Tutorials/Questions & Answers:
MySQLselect into new table Example code
MySQLselect into new table Example code  Hi, I have a big table in MySQL database and I want to create a new table with all the data in it. I have heard that there is SQL statement "mysql select into new table" which selects
MYSQL - mysql copy table to another table example by creating new table
MYSQL - mysql copy table to another table example by creating new table ... a new table with all the data from this table. How to create a new table and select all the data into this new table? Thanks   Hi, You can use
Advertisements
mysql select into table from another table example
from one table into another table. Check the example at MySQLselect into new table Example code Thanks... the correct example of select into table from another table example in MySQL
MySQL take backup of a table - example code needed
MySQL take backup of a table - example code needed  How to take backup of a table in MySQL? I have a database which contains many tables. What is the command to take the backup of one table with data from database? Thanks
How to solve this java code by adding the student marks not in the list of the table. For example -10 and 156 in GUI?
How to solve this java code by adding the student marks not in the list of the table. For example -10 and 156 in GUI?  import java.awt.*; import...[] args) { JLabel lab=new JLabel("Enter number of students in class
Code to register a new patient in a clinic
Code to register a new patient in a clinic  Hi, How do i write a code that allows a user to enter someone's name and then search for that name from a text file. If the name is not available it opens up a form to register
Adding a New Column Name in Database Table
; Above code is used for adding a new column in the database table and takes... new column in table example! Enter table name: Student... Adding a New Column Name in Database Table  
example code
example code  code for displaying a list from another class on a midlet
how to create a new table for the already existing user in the website
how to create a new table for the already existing user in the website  haiii....i want the code in jsp "how to create a new database for every user that has been already existing in the website?"....plzzzz help me
my table should be reseted to new value upon the selection of the combo box..
my table should be reseted to new value upon the selection of the combo box... DefaultTableModel(); table = new JTable(model); model.addColumn(" INVO... e) { } public void keyTyped(KeyEvent e) { }}); sc1 = new JScrollPane(table
How do we create new table apart from mapping with existing table ?
How do we create new table apart from mapping with existing table ?  Hi, How do we create new table apart from mapping with existing table ? Thanks
jsp code for allocating a room for a new guest
jsp code for allocating a room for a new guest  i am implementing a project on online hotel reservation system.please give code in jsp to allocate a room for a guest
How To Insert A New Record to MS Access table database in GUI
How To Insert A New Record to MS Access table database in GUI  Hello... that involves inserting a record into a 6-column table in my MS Access database table. I'm... in advance for your help. Below is part of my java code. private class
Add new column to table using DBCP
Code: import java.sql.*; import org.apache.commons.dbcp.BasicDataSource; public class AddColumn {   public static void main(String[] args) {   
Example Code
Example Code       Example Code Following are the some of example code with demos :  jQuery blur event jQuery change event
HTML table example
HTML Table example In this page we will learn how to use HTML table tag... form on the web page. Here is an example of HTML Table... applications The above example shows how to use table tag
Change Column Name of a Table
;    This section provides you an example with code... of code: ALTER TABLE   table_name   CHANGE   old...;+table+" CHANGE "+old_col+" "+new_col+" 
Table & the Border attribute
;    The Tutorial illustrates an example from Table and the Border attribute. In this Tutorial, the code explains to create a table and the border with a specified attribute. Understand with Example To create a table in HTML
servlet code for finding the table for given number
servlet code for finding the table for given number  servlet code for finding the table for given number?   Here is a an example that accepts a number from the user and display its multiplication table using servlet. 1
Arrange a Column of Database Table
;    This section provides an example with code...;java ColumnDescOrder Descending order example! Enter table name...; This section provides an example with code that arrange the records
Pagination example with html code
Pagination example with html code  Hi, could u please provide pagination code with clear cut explanation. Thanks in advance
new
new   @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ <[email protected] contentType...="submit"><br><br><br> <table border="2">... { /* * TODO output your page here. You may use following sample code
Dragging and dropping HTML table row to another position(In Jsp) and save the new position (values) also in database
Dragging and dropping HTML table row to another position(In Jsp) and save the new position (values) also in database  Hi members, I have one Html table in jsp page and i am iterating values (in columns of html table)from
new
new    hi i am jane pls explain the difference between string greeting = good morning string greeting = new string ("good morning
new
new  hi the difference between string sname = good morning string sname =new("good morning
new
new    hi i am jane pls explain the difference between heap memory and stack memory
Example Code - Java Beginners
Example Code  I want simple Scanner Class Example in Java and WrapperClass Example. What is the Purpose of Wrapper Class and Scanner Class . when i compile the Scanner Class Example the error occur : Can not Resolve symbol
Simple but confusing code... Parent obj1 = new Parent(); Parent obj2 = new Child();
Simple but confusing code... Parent obj1 = new Parent(); Parent obj2 = new Child();  Hi friends I got confused in the below code snippet: Parent.... Then we create Parent obj2 = new Child(); <--------------- here in this code
Need an example of basic code.
Need an example of basic code.   Im working on an art project that I want to use some code in, and I am proficient in python but that looks fairly... of the building blocks of my idea so if someone could provide an example I would
Need an example of basic code.
Need an example of basic code.   Im working on an art project that I want to use some code in, and I am proficient in python but that looks fairly... of the building blocks of my idea so if someone could provide an example I would
Need an example of basic code.
Need an example of basic code.   Im working on an art project that I want to use some code in, and I am proficient in python but that looks fairly... of the building blocks of my idea so if someone could provide an example I would
Tutorials   
Java Spring Hibernate Struts Training How to Fetch Data using dropdown option How to get day from date in SQL? Example of sorting results in MySQL Distinct and Limit example in MySQL How to download install and use MySQL workbench? Example of Average, Sum, Min and Max functions in MySQL How to delete data from MySQL? Update SQL Query Example Order by example in MySQL AND and OR Operators in MySQL Query Where clause with query in MySQL How to use select Statement in MySQL? How to insert data into MySQL Table? Create Database and tables in MySQL example of before insert trigger in mysql Failed to Call Procedure MY Sql Query Error - Not able to Understand the issue which query will be run for previous(button) question How to access data yearly from DB in C# ? Fastest way to upload huge raw data in database - c#, Java or stored procedure DB Insert Nb hours between 2 time stamps meets specific criteria mysql select into table from another table example MySQLselect into new table Example code How to create a .mdf file from script (.sql) Please help me out fixing broken relational links in MySQL database after an upgrade How do I upgrade mysql? mysql 4.x to 5.x upgrade problem Upgrading a PHP/MYSQL application? upgrading sql query join phpmyadmin in whm whm php version update php cpanel cpanel mysql downgrade cpanel mysql version upgrade mysql whm upgrade mysql 4 5 cpanel upgrade mysql cpanel server Did my upgrade from mySQL 5.1 to 5.5 work Upgrade to MySQL 5.5 ? - cPanel Mem use upgrade from MySQL 5.1 to 5.5 - cPanel Upgrading MySQL from 5.0 to 5.1 or 5.5 - cPanel Mysql Upgrade on WHM (Mysql 5.1 to 5.5)cPanel Mysql Upgrade on WHM (Mysql 5.1 to 5.5) - cPanel Updating from MySQL 5.0 to 5.5 cPanel MySQL 5.1 upgrade to 5.5 error Charset problem upon publishing PHP + MySQL website MySQL issue: Table 'data_dictionary.CHARACTER_SETS' doesn't exist SQL Error Version 5.5.15

Ads

 
Advertisement null

Ads