Jump to content

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


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. :)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.