Back
I want to copy a table's schema as well as the data within that table to another database table in another database on a live server. How could I do this?
Use the below code, if you want to copy the table from one database to another database:
CREATE TABLE db2.table LIKE db1.table;INSERT INTO db2.table SELECT * FROM db1.table;
CREATE TABLE db2.table LIKE db1.table;
INSERT INTO db2.table SELECT * FROM db1.table;
31k questions
32.8k answers
501 comments
693 users