I believe that you will not be familiar with the operation of copying data from a MySQL table. The following describes how to copy data from a MySQL table to a new table. 1. MySQL copies the table structure and data to the new table CREATETABLE new table SELECT * FROM old table 2. Only copies the table structure to the new table CREATETABLE new table SELECT * FROM old table WHERE
I believe that you will not be familiar with the operation of copying data from a MySQL table. The following describes how to copy data from a MySQL table to a new table. 1. MySQL copies the TABLE structure and data to the new table create table new table select * FROM the old TABLE 2. Only copies the TABLE structure to the new table create table new table select * FROM the old TABLE WHERE
I believe that you will not be familiar with the operation of copying data from a MySQL table. The following describes how to copy data from a MySQL table to a new table.
1. MySQL copies the table structure and data to the new table
Create table new TABLE
SELECT * FROM old table
2. Only copy the table structure to the new table
Create table new TABLE
SELECT * FROM old table WHERE 1 = 2
That is, make the WHERE condition invalid.
Method 2: (mysql of earlier versions is not supported, mysql 4.0.25 is not supported, and mysql 5 is supported)
Create table new TABLE
LIKE old table
3. copy the data from the old table to the new table (assuming the two tables have the same structure)
Insert into new table
SELECT * FROM old table
4. copy the data from the old table to the new table (assuming the two tables have different structures)
Insert into new table (Field 1, Field 2 ,.......)
SELECT Field 1, Field 2 ,...... FROM old table