title: Execute the result of a sql select in MySql
body: <p>I am trying to get MySql to execute the result of the below statement as further sql statements. I believe in oracle sqlplus this is achieved using the <code>spool</code> function. How is this achieved in <strong>Mysql</strong>?</p>
  
  <pre><code>select concat('OPTIMIZE TABLE `', ist.TABLE_SCHEMA,'`.',  ist.TABLE_NAME, ';') FROM INFORMATION_SCHEMA.TABLES ist where table_schema = 'my_schema';
  </code></pre>