title: Calculate the percentage of filled columns per row
body: <p>I am trying to calculate the number of filled columns per row. For example the the column Perc is the value I wish to calculate. </p>
  
  <pre><code>id   Col1   Col2  Col3  Perc 
  1    NULL   1     2     75%   #3 out of 4
  2    2      NULL  NULL  50%   #2 out of 4  
  3    NULL   NUll  NULL  25%   #1 out of 4
  4    a      Yes   No    100%  #4 out of 4
  </code></pre>
  
  <p>I read <a href="https://stackoverflow.com/questions/24700613/count-number-of-null-variables-per-row-mysql">count number of Null variables per row mysql</a>, wich offers a possible solution. However in my case the column names and number change frequently. So i would like a more robust query which does not have to be altered every time the names or column count changes. </p>