title: Using MySQLdump for sub-set of database migration
body: <p>I've been using both mysql and mysqldump to teach myself how to get data out of one database, but I consider myself a moderate MySQL newbie, just for the record.  </p>
  
  <p>What I'd like to do is get a sub-set of one database into a brand new database on a different server, so I need to create both the db/table creation sql as well as populating the data records.</p>
  
  <p>Let's say my original db has 10 tables with 100 rows each.  My new database will have 4 of those tables (all original columns), but a further-refined dataset of 40 rows each.  Those 40 rows are isolated with some not-so-short SELECT statements, one for each table.</p>
  
  <p>I'd like to produce .sql file(s) that I can call from mysql to load/insert my exported data.  How can I generate those sql files?  I have HEARD that you can call a select statement from mysqldump, but haven't seen relevant examples with select statements as long as mine.</p>
  
  <p>Right now I can produce sql output that is just the results set with column names, but no insert code, etc.</p>
  
  <p>Assistance is GREATLY appreciated.</p>