title: how to update table if values in another table are inserted
body: <pre><code>mysql&gt; select * from Teams;  
  +-----------+---------+  
  | team_name | team_id |
  +-----------+---------+  
  | India     |       1 |  
  | England   |       2 |  
  | Germany   |       3 |  
  | Italy     |       4 |  
  | Spain     |       5 |  
  | Belgium   |       6 |  
  | Brazil    |       7 |  
  | France    |       8 |  
  +-----------+---------+
  8 rows in set (0.00 sec)
  
  
   select * from Players where team_id=7 or team_id=8;
  +-----------+----------------+------------+------+--------+--------+---------+
  | player_id | player_name    | position   | age  | height | weight | team_id |
  +-----------+----------------+------------+------+--------+--------+---------+
  |       130 | Jefferson      | Goalkeeper |   25 |      6 |     90 |       7 |
  |       131 | Dani Alves     | Defender   |   30 |      6 |     65 |       7 |
  |       132 | David Luiz     | Defender   |   26 |      6 |     73 |       7 |
  |       133 | Thiago Silva   | Defender   |   29 |      6 |     69 |       7 |
  |       134 | Marcelo        | Defender   |   24 |      5 |     65 |       7 |
  |       135 | Paulinho       | Midfielder |   27 |      6 |     68 |       7 |
  |       136 | Ramires        | Midfielder |   25 |      6 |     59 |       7 |
  |       137 | Oscar          | Midfielder |   21 |      5 |     61 |       7 |
  |       138 | Lucas Moura    | Striker    |   19 |      5 |     62 |       7 |
  |       139 | Neymar         | Striker    |   21 |      5 |     63 |       7 |
  |       140 | Alex Pato      | Striker    |   25 |      6 |     69 |       7 |
  |       150 | Hugo Lloris    | Goalkeeper |   28 |      6 |     75 |       8 |
  |       151 | Mathiu Debuchy | Defender   |   25 |      6 |     70 |       8 |
  |       152 | Philip Mexes   | Defender   |   34 |      6 |     73 |       8 |
  |       153 | Younes Kaboul  | Defender   |   29 |      6 |     81 |       8 |
  |       154 | Patrice Evra   | Defender   |   34 |      6 |     75 |       8 |
  |       155 | Paul Pogba     | Midfielder |   21 |      6 |     68 |       8 |
  |       156 | Samir Nasri    | Midfielder |   27 |      6 |     69 |       8 |
  |       157 | Yohan Cabaye   | Midfielder |   26 |      6 |     64 |       8 |
  |       158 | Frank Ribery   | Striker    |   28 |      5 |     63 |       8 |
  |       159 | Oliver Giroud  | Striker    |   25 |      6 |     74 |       8 |
  |       160 | Karim Benzema  | Striker    |   24 |      6 |     71 |       8 |
  +-----------+----------------+------------+------+--------+--------+---------+
  22 rows in set (0.00 sec)
  
  
  
  mysql&gt; select * from Matches where match_id=4;
  +----------+------------+----------+----------+-----------+-----------+
  | match_id | match_date | hometeam | awayteam | homescore | awayscore |
  +----------+------------+----------+----------+-----------+-----------+
  |        4 | 2014-06-28 |        7 |        8 |         0 |         0 |
  +----------+------------+----------+----------+-----------+-----------+
  1 row in set (0.00 sec)
  </code></pre>
  
  <p>(hometeam,awayteam are foreign keys Teams.team_id)</p>
  
  <pre><code>mysql&gt; select * from livescore;
  +----------+-----------+----------+---------+
  | score_no | player_id | match_id | team_id |
  +----------+-----------+----------+---------+
  |        1 |       155 |        4 |       8 |
  +----------+-----------+----------+---------+
  1 row in set (0.00 sec)
  </code></pre>
  
  <p><code>(player_id,match_id,team_id are foreign keys of Players,Matches,Teams)</code>
  I have a <code>Players</code> table wherein I have all players info.  </p>
  
  <p>What I want is when a new row is inserted in <code>'livescore'</code> the <code>homescore,awayscore</code> should be increased accordingly. ie If the player belongs to <code>team_id=8</code> in <code>livescore</code> then the <code>awayscore</code> where <code>awayteam=8</code> must be increased <code>+1</code>.</p>