title: calculate sales per day in MySQL
body: <p>I have a simple table which holds the date and the total sales made for a certain group:</p>
  
  <pre><code>date       | totalsales
  =======================
  2014-05-01 | 3000
  2014-05-02 | 3100
  2014-05-03 | 3500
  2014-05-04 | 3650
  </code></pre>
  
  <p>I like to calculate some things like:</p>
  
  <ul>
  <li>sales per day</li>
  <li>average sales</li>
  <li>growth in %</li>
  </ul>
  
  <p>Result should look like (calculate by hand so maybe wrong :) )</p>
  
  <pre><code>date       | sales  | average | growth
  =======================================
  2014-05-01 |   0    |  0      |   0
  2014-05-02 | 100    | 50      | 100
  2014-05-03 | 400    | 166.66  | 400
  2014-05-04 | 150    | 162.5   |  37.5
  </code></pre>
  
  <p>Is this even possible in a sql statement or should I calculate with PHP or another server software?</p>