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 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

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
example code
example code  code for displaying a list from another class on a midlet
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
Example Code
Example Code       Example Code Following are the some of example code with demos :  jQuery blur eventADS_TO_REPLACE_1 jQuery change
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
Pagination example with html code
Pagination example with html code  Hi, could u please provide pagination code with clear cut explanation. Thanks in advance
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
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
MPVolumeView Example code
MPVolumeView Example code  Hi, Please let's know how I can add MPVolumeView control in my iPhone application? ThanksADS_TO_REPLACE_1   Hello, You can use the following code: MPVolumeView *volumeView
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
NSMutableArray Example Code
NSMutableArray Example Code  creating and allocating memory... the example given below.. NSMutableArray *array; array = [[NSMutableArray... the example given below.. NSMutableArray *array; array = [[NSMutableArray alloc]init
Change Column Name of a Table
;    This section provides you an example with code...;. Description of code: ALTER TABLE   table_name  ... of new column.ADS_TO_REPLACE_2 Here is the code of program: import 
No complete code for AbstractWizardFormCOntroller Example
No complete code for AbstractWizardFormCOntroller Example  No complete codes
Adding a New Column Name in Database Table
; data_type; Above code is used for adding a new column in the database table...\jdbc\jdbc-mysql>java AddColumn Adding new column in table example... Adding a New Column Name in Database Table  
Arrange a Column of Database Table
an example with code that arrange the records of database table in descending order...;    This section provides an example with code... of code: SELECT   col_name  FROM   table_name 
Table & the Border attribute
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
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
Example code of adding placeholder in UItextFeild
Example code of adding placeholder in UItextFeild  Ho to add add the placeholder text in UITextField in IOS program programmatically? Thanks  ... is the code example: mytext.placeholder = @"Enter User Name"; Thanks
Hibernate Criteria Transformer Example code
Hibernate Criteria Transformer Example code  Hello, I am trying to find the example of Hibernate Criteria Transformer. Tell me the good tutorial of Hibernate Criteria Transformer with source code. Thanks   Hi, Check
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
Example code of jQuery animation
Example code of jQuery animation       Example code of jQuery animation... effects also. Given below link contain the example code for custom animation
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
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
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 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
Java Hello World code example
Java Hello World code example  Hi, Here is my code of Hello World program in Java: public class HelloWorld { public static void main..., Learn Java Tutorials and download running code examples. ThanksADS
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) {   
Spring 3.0 Tutorials with example code
Spring 3.0 - Tutorials and example code of Spring 3.0 framework... of example code. The Spring 3.0 tutorial explains you different modules... download the example code in the zip format. Then run the code in  Eclipse
Tag Inside Table in HTML
;  The Tutorial illustrates an example from Tag Inside Table in HTML.In this code we define a HTML page and show you to create a tag inside a Table in HTML. The following tags used in code to create tag inside table in HTML
Database Table Creation Example with JDBC Batch
Database Table Creation Example with JDBC Batch: In this example, we... create table statement for create new table in the  database and add... is: The database table is: Download source code
NSLog NSDictionary Example code
The following code example prints the data of NSDictionary. You can use the NSLog function to debug your program. In this example we will be showing you the code that prints the value of NSDictionary object. // // 
java code for threading example for connecting data base
java code for threading example for connecting data base  Write... the employee records from the emp table. Stores the employee objects... table columns. Create another class having different methods to contain
JDBC: Alter Table Example
JDBC: Alter Table Example This tutorial describe how to alter existing table... You can add new field -  sql= " ALTER TABLE student ADD location... new field 'location' to the table 'student'. package jdbc
Hibernate Criteria Query Example with source code
good example of Hibernate Criteria Query Example with source code? Thanks   Here is good Example program of Hibernate Criteria Query with source code... Query Example page and see the source code of the program. Check the Latest
need pyspark lit function example code
need pyspark lit function example code  Hi, I want to use the lit... to use it. It will be very helpful for me if someone shares me the code of pyspark lit function example. (adsbygoogle = window.adsbygoogle || []).push
JDBC: Drop Table Example
_TO_REPLACE_5 Drop Table Example... Table is deleted. If you execute this code...JDBC: Drop Table Example In this section, we will discuss how to drop table... int.ADS_TO_REPLACE_4 Example : In this example we are dropping table, named student
JDBC Delete All Rows In Table Example
JDBC Delete All Rows In Table Example:  In this tutorial provide the example of  how to delete  all records from table using mysql ...;  that execute and delete all records from table and display output "
Please explain what is hibernatetemplate with an example code.
Please explain what is hibernatetemplate with an example code.  hi, Please explain Hibernate template example code to me..   Hello Friend, HibernateTemplate is a helper class that facilitate to query/retrieve data
How can i add a new count to this source code ? - Java Beginners
How can i add a new count to this source code ?  Hi everyone I...;ZHTYPE (Just Logical) Please tell me how can i see this output? Code... This output with this code is true but I want add ZHTYPE at the end of each line
How can i add a new count to this source code ? - Java Beginners
How can i add a new count to this source code ?  Hi everyone I...;ZHTYPE (Just Logical) Please tell me how can i see this output? Code... with this code is true but I want add ZHTYPE at the end of each line + XTSM/XTS please
Delete a Specific Row from a Database Table
from a specific database table. Here is an example with code which provides... deletes the record in the employee6 table which has Emp_code = '1'.   employee6: This is a table name of a specific database.   Emp_code: It specifies
JDBC Drop Table Example
JDBC Drop Table Example:   In this tutorial we will learn  how drop Table from Database. This tutorial  first  create database "testjdbc" if not exist and create a table "user" under "
NSLog print NSString example code
Following example prints the value of NSString object on the console using the NSLog function which can be used to debug the iPhone application. // // ...) print;  @endADS_TO_REPLACE_3 The implementation class code is as follows
How to populate an HTML table using jstl code - Spring
jstl code to populate a table is like...How to populate an HTML table using jstl code  Hi I want to populate an HTML table using jstl code.I am using Hasp map.For 1 column its okay
new to EJBs exceptions while excuting Client code - EJB
new to EJBs exceptions while excuting Client code  Hi i am new... then it is compiling fine can any one help me please.. i am posting the client code and the EXCEPTIONS here... thanks

Ads