In MySQL, how to copy the content of one table to another table within the same database?

后端 未结 8 1296
既然无缘
既然无缘 2020-12-22 16:40

I am new to MySQL. I would like to copy the content of one table to another table within the same database. Basically, I would like to insert to a table from another table.

8条回答
  •  无人及你
    2020-12-22 17:15

    This worked for me,

    CREATE TABLE newtable LIKE oldtable;

    Replicates newtable with old table

    INSERT newtable SELECT * FROM oldtable;

    Copies all the row data to new table.

    Thank you

提交回复
热议问题