title: How INSERT data in two tables in a single query?
body: <p>I have master table for data:
  table name: <code>master_tbl</code></p>
  
  <p><code>id</code> is auto increment</p>
  
  <pre><code>id  name        age sex
  1   Mario       13  M
  2   Luigi       14  M
  3   Princess    13  F
  </code></pre>
  
  <blockquote>
    <p>INSERT INTO master_tbl (name, age, sex) VALUES ('Mario', 13, 'M');</p>
  </blockquote>
  
  <p>then i have other table for activity
  table name: <code>activity</code></p>
  
  <p>id is anti increment also</p>
  
  <blockquote>
    <p>id_ref should get the id from master_tbl</p>
  </blockquote>
  
  <pre><code>id  id_ref  exercise    duration
  1   1       Running     1
  2   1       Swimming    2
  3   1       Biking      1
  4   2       Biking      2
  5   2       Rowing      1
  6   3       Running     2
  </code></pre>
  
  <p>How to insert data into 2 tables where in activity table, it will get the <code>id</code> from master table.
  my goal is to use it as grouper of data that it is belong to that specific request in master table.</p>
  
  <p>thanks.</p>