title: How to process data from one table and isert it to another table in MySQL?
body: <p>I want to insert values from one of my tables to another.</p>
  
  <p>I have a following table:</p>
  
  <pre><code>  Act (
    id  INT NOT NULL AUTO_INCREMENT,
    type VARCHAR(20),
    Act_date DATETIME,
    place VARCHAR(20)  
    );
  </code></pre>
  
  <p>where type has 2 possible values: "birth" and "death". All the columns are already filled.
  Now, I am trying to make a procedure or a function which would calculate the difference between Acts of type "birth" and acts of type "death" for a given time and put the results in a different table, something like:</p>
  
  <pre><code>  Population_Growth(
    id INT NOT NULL AUTO_INCREMENT,
    time DATE,
    place VARCHAR(20),
    result INT
    );
  </code></pre>
  
  <p>where result would be the difference between Acts of type "birth" and acts of type "death"</p>
  
  <p>I would appreciate any help.</p>