title: variable database name
body: <p>Is there any way in MySQL to put the name of the database into a variable?
  For example, when I have a database called 'db1', can I do something like this:</p>
  
  <pre><code>set @db= 'db1';
  select * from @db.mytable;
  </code></pre>
  
  <p>EDIT: There is another example of what I want to do:</p>
  
  <pre><code>set @dbfrom= 'db1';
  set @dbto= 'db2';
  insert into @dbto.mytable (col1,col2,col3) select col2,col1,col3 from @dbfrom.mytable;
  </code></pre>