21. Copy table

1. Copy only the table structure
Only copy the table structure, including the primary key, index, but will not copy the table data.

create table tableName like someTable;

Insert picture description here

2. Only copy table data.
Copy the general structure and all data of the table, without copying the primary key, index, etc.

create table tableName select * from someTable;

Insert picture description here

3. Completely copy the table structure + data to
complete in two steps, first copy the table structure, and then insert the data.

create table tableName like someTable; 
insert into tableName select * from someTable;

Insert picture description here

Guess you like

Origin blog.csdn.net/Jgx1214/article/details/107496289
21.