title: AVG and STD in MySQL using field values of the same row
body: <p>I know how to use avg() and std() functions in MySQL to calculate averages or standard deviations from a query or query with group by</p>
  
  <pre><code>select avg(amount) from table
  select mykey,std(amount) from table group by key
  </code></pre>
  
  <p>My question is, can I use those functions when the set of values are in different columns of a row?</p>
  
  <pre><code>mykey value1 value2 value3 value4 value5 myavg mystd
  1        5.0    3.0    4.0    5.0    3.0
  </code></pre>
  
  <p>myavg as the average of value1,value2,value3,value4 and value5  (in the example (5+3+4+5+3)/5 = 4)
  stdmykey as the standard deviation of value1,value2,value3,value4 and value5</p>
  
  <p>some kind of...</p>
  
  <pre><code>update table set
     myavg = avg(value1,value2,value3,value4,value5),
     mystd = std(value1,value2,value3,value4,value5)
  </code></pre>