I would like to provide the subset of my database required to reproduce a
select query. My goal is to make my computational workflow reproducible (as in reproducible research).
Is there a way that I can incorporate this select statement into a script that dumps the queried data into a new database, such that the database could be installed on a new mysql server, and the statement would work with the new database. The new database should not contain records in addition to those that have been used in the query.
Update: For clarification, I am not interested in a csv dump of query results. What I need to be able to do is to dump the database subset so that it can be installed on another machine, and then the query itself can be reproducible (and modifiable with respect to the same dataset).
For example, my analysis might query a subset of data that requires records from multiple (in this example 3) tables:
select table1.id, table1.level, table2.name, table2.level from table1 join table2 on table1.id = table2.table1_id join table3 on table3.id = table2.table3_id where table3.name in ('fee', 'fi', 'fo', 'fum');