Search code examples
phpmysqlsqlansi-sql

Importing data from one MySQL dbto another MySQL Db?


Can you please tell me how to import data from one MySQL Db to another MySQL DB. Data schema of both databases is totally different, the second database is the normalized version of first database.

Thanks in advance


Solution

  • I agree what Stephen says, but you can achive it whith a similar technique. But you have to create more elaborated queries. You can do something like:

    INSERT INTO table1(field1, field2,...) SELECT field4,field1,... FROM table1;
    

    Obviously you have to do it in the correct order, IMO this is a good approach so you can create complex queries with joins, etc.