MySQL Forums
Forum List  »  Data Recovery

Re: Importing/Restoring Multiple mysqldumps to One Database
Posted by: Jay Alverson
Date: October 01, 2009 12:48PM

I think you can use the INSERT...SELECT statement to simply append the data
from other tables into a single one; even if they're in different schemas.

Chapter 12.2.5.1. INSERT ... SELECT Syntax
in the manual.

You can test of course with three tables (or more). Then once the data
is consolidated simply drop (delete) the tables you no longer need.

Table1
Table2
Table3

create Table4 like Table1;  #copy of the 1st table...

INSERT into Table4 SELECT * FROM Table1;
INSERT into Table4 SELECT * FROM Table2;
INSERT into Table4 SELECT * FROM Table3;

Then do a count(*) on Table4 see if the same number of records
of the combined other tables = the total.

then...

DROP TABLE Table1, Table2, Table3;

If they're in different schemas/databases simply prefix the tables
with the schema names.

>

Thanks, Jay

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Importing/Restoring Multiple mysqldumps to One Database
2607
October 01, 2009 12:48PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.