title: Calculating percentage in PostgreSql
body: <p>I have a table like this for example:</p>
  
  <pre><code>string adm
  A       2
  A       1
  B       2
  A       1
  C       1
  A       2
  </code></pre>
  
  <p>And through a SQL query I want something like this:</p>
  
  <pre><code>string    perc_adm (%)
  A            50
  B            100
  C            0
  </code></pre>
  
  <p>I want the percentage of number 2 occurrence in each string. I am able to get this in separate conditions but I need just one condition with it. 
  Also I have some divided by zero error. How do I correct that in the condition?</p>