List:General Discussion« Previous MessageNext Message »
From:Jerry Schwartz Date:October 7 2009 7:12pm
Subject:RE: Dump / restore rows in table?
View as plain text  
>-----Original Message-----
>From: Jerry Schwartz [mailto:jschwartz@stripped]
>Sent: Wednesday, October 07, 2009 2:15 PM
>To: 'John Oliver'; mysql@stripped
>Subject: RE: Dump / restore rows in table?
>
[JS] I should have mentioned that you can do this even if you are creating a 
table in another database (on the same host).

>Are you just trying to copy a subset of one table into another? If so, simply
>do this:
>
>CREATE TABLE new_one SELECT * FROM old_one LIMIT 1000,5000;
>
>That will create a table with the same columns, but no keys or such. If you
>want to copy the key structure, it will take you two commands:
>
>CREATE TABLE new_one LIKE old_one;
>INSERT INTO new_one SELECT * FROM old_one LIMIT 1000,5000;
>
>If you want a random selection (say 1% of your original records), use
>
>... WHERE RAND() < .01;
>
>Regards,
>
>Jerry Schwartz
>The Infoshop by Global Information Incorporated
>195 Farmington Ave.
>Farmington, CT 06032
>
>860.674.8796 / FAX: 860.674.8341
>
>www.the-infoshop.com
>
>
>>-----Original Message-----
>>From: John Oliver [mailto:joliver@stripped]
>>Sent: Wednesday, October 07, 2009 12:29 PM
>>To: mysql@stripped
>>Subject: Dump / restore rows in table?
>>
>>I did try to find out how to do this in the manual, but "row" and
>>"table" occur so many times...
>>
>>I want to dump a certain number of rows from one table, and then restore
>>them to another database.  I'm guessing I'd try "mysqldump -u root
>>-pPASSWORD database_name table_name" and then add something to specify
>>rows 1000-1050.  And then I'm guessing that mysql < result.sql would
>>restore?  Or would it not know what table it came from, and I'd have to
>>specify that?
>>
>>--
>>***********************************************************************
>>* John Oliver                             http://www.john-oliver.net/ *
>>*                                                                     *
>>***********************************************************************
>>
>>--
>>MySQL General Mailing List
>>For list archives: http://lists.mysql.com/mysql
>>To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
>>infoshop.com
>
>
>
>
>
>--
>MySQL General Mailing List
>For list archives: http://lists.mysql.com/mysql
>To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
>infoshop.com




Thread
Dump / restore rows in table?John Oliver7 Oct
  • Re: Dump / restore rows in table?Dan Nelson7 Oct
  • RE: Dump / restore rows in table?Jerry Schwartz7 Oct
    • RE: Dump / restore rows in table?Jerry Schwartz7 Oct