Jump to content

subdividing 1 mysql table into several tables, exporting as .sql files


ultrus

Recommended Posts

Hello,

Normally, I would export a table in phpMyAdmin as a .sql file so that I can import that file into another database on another system. Today, I need a different solution as I'm migrating a 400MB+ table into an SQLLite database, separating the table into 708 smaller tables that make sense for the project.

 

How do I export query results as a .sql file?

 

I understand how to export a query as a table like this:

CREATE TABLE subTable SELECT * FROM hugeTable WHERE 1;

Of course, that would create 708 tables that would be quite the hassle to export one at a time through phpMyAdmin. :P

 

If I had 708 .sql files, I can write a script to import these to the new database.

 

OR

 

Perhaps I should create tab delimited or xml files that a script will parse and write to the database...just solved my problem while typing! heh.

 

I'm open to any other creative suggestions. :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.