MySQL migration table

1. Copy the table structure and data into a new table 
CREATE TABLE new table the old table SELECT * FROM 


2. Copy only the table structure to a new table 
CREATE TABLE new table the old table SELECT * FROM WHERE 1 = 2 
ie: the WHERE condition is not satisfied. 


3. Copy the old data table to the new table (table structure as assuming two) 
the INSERT the INTO new table Old table SELECT * FROM 


4. Copy the old data into the new table the table (assuming the two are not the same table structure) 
the INSERT the INTO new table (Field 1, Field 2, .......) the SELECT field 1, field 2, ..... . FROM the old table
----------------
copyright: original article is CSDN blogger "love_my_lifes", and follow CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
Original link: https: //blog.csdn.net/love_my_lifes/article/details/80649553

Guess you like

Origin www.cnblogs.com/sun5/p/11735788.html