title: How to calculate difference between two rows in SQL?
body: <p>My tables are:</p>
  
  <p>Bowlers: BName - Handed - Phone</p>
  
  <p>Performances: BName - TName - Score</p>
  
  <p>Tournaments: TName - TDate</p>
  
  <p>I am trying to figure out how to calculate the difference in score for a bowler named Fred. My code so far is:</p>
  
  <pre><code>select tname, tdate, score
  from tournaments
  natural inner join 
  performances
  where bname = 'Fred'
  order by tdate;
  </code></pre>
  
  <p>This gives me a table like this:</p>
  
  <pre><code> TName                    TDate                Score
   ------------------------ ------------ -------------
   Tournament 1             1/1/2014               250
   Tournament 2             1/8/2014               245
   Tournament 3             2/10/2014              215
  </code></pre>
  
  <p>Now I just need to add a fourth column that calculates the difference in his score from the previous tournament. So the finished table would look like this:</p>
  
  <pre><code> TName                    TDate                Score     Score_Dif
   ------------------------ ------------ ------------- -------------
   Tournament 1             1/1/2014               250             0
   Tournament 2             1/8/2014               245            -5
   Tournament 3             2/10/2014              215           -30
  </code></pre>
  
  <p>Any help is greatly appreciated!</p>