We can find lot of solutions to make copy of table.
Here is one of the simple solution which I got while google.
Copy table with in a Database
use databasename;
CREATE TABLE exampletable_copy LIKE exampletable;
INSERT exampletable_copy SELECT * FROM exampletable;
Copy table from Database-1 to Database-2
use databasename2;
CREATE TABLE exampletable_copy LIKE exampletable.databasename1;
INSERT exampletable_copy SELECT * FROM exampletable.databasename1;
Hint:
First query used to create table with structure of original table.
Second query used to copy data from table to table-copy.
Here is one of the simple solution which I got while google.
Copy table with in a Database
use databasename;
CREATE TABLE exampletable_copy LIKE exampletable;
INSERT exampletable_copy SELECT * FROM exampletable;
Copy table from Database-1 to Database-2
use databasename2;
CREATE TABLE exampletable_copy LIKE exampletable.databasename1;
INSERT exampletable_copy SELECT * FROM exampletable.databasename1;
Hint:
First query used to create table with structure of original table.
Second query used to copy data from table to table-copy.
No comments:
Post a Comment