Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (20.3k points)

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?

1 Answer

0 votes
by (40.7k points)

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;

Related questions

0 votes
1 answer
asked Jul 30, 2019 in SQL by Tech4ever (20.3k points)
0 votes
1 answer
0 votes
1 answer

Browse Categories

...