title: Fill column from other data in row being inserted
body: <p>I am trying to come up with a trigger that fills a column of a row that I insert/update with a score that depends on the the numeric values on other columns of that same row.</p>
  
  <p>For example</p>
  
  <pre><code>+------+------+------+------+------+------+
  | col1 | col2 | col3 | col4 | col5 | col6 |
  +------+------+------+------+------+------+
  | 1    | 2    | 1    | 3    | 1    |      |
  +------+------+------+------+------+------+
  </code></pre>
  
  <p>This is the row I want to insert, I would like to fill <code>col6</code> with a score calculated using the values of the other columns</p>
  
  <pre><code>(100 - avg(col1:col5)/4*100)
  </code></pre>
  
  <p>Can I do this through a trigger or procedure? Should I do this before or after the insert?</p>