Duplicate a table

suggest change

To duplicate a table in MySQL:

CREATE TABLE newtable LIKE oldtable;
INSERT INTO newtable SELECT * FROM oldtable;

CREATE TABLE ... LIKE copies the column definitions, not the rows. INSERT INTO copies the rows. LIKE in CREATE TABLE is not standard SQL.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents