Re: Migrating MySQL Table Data

From: Date: Sun, 04 Feb 2001 15:38:44 +0000
Subject: Re: Migrating MySQL Table Data
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-6355@lists.php.net to get a copy of this message
The CREATE TABLE .. FROM ... SQL will do what you require, but I don't think this is included in MySQL (one to check)...however if performance is becoming an issue, ,then you may want to consider migrating to a different DBMS (mySQL is not so good at handling large record sets, and has a much cut-down set of SQL sytanx). Sticking with mysql however, if it was a once off move that needed to take place (which is what it sounds like) then it wouldn't be hard to write a simple agent .. somethi like 1. select all records in the original table 2. Loop through all the records (rows) 2.1. extract the fields from the currently selected row 2.2. INSERT this into your new table 2.3 go onto the next row 3. Once all are done, drop the unwanted columns from your old table Inelegant ,yes, but it will work! If you want more help, contact me OL Tom On Sun, 4 Feb 2001, phobo wrote: > I am in the process of improving a database scheme considerably in MySQL, by > breaking tables into smaller tables and so one. I am wondering if there is a > simple SQL statement to take ALL ROWS of fields 'f1', 'f2', 'f3', > and copy > them to the another table.... Then I can remove the fields in the original > table. > > eg something like > INSERT INTO BetterSmallerTable SET (PrimKey,Red,Green,Blue) VALUES (SELECT > PrimKey,Red,Green,Blue FROM BigClumsyTable) ?? > > Thanks, > Siggy > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.db (#6355) next »