title: How to count all distinct rows?
body: <p>If I have a table like below, how can I count and sum all distinct values?</p>
  
  <pre><code>student_name | section | score | class
  -------------|---------|-------|-------
  John         | B       | 32    | 8
  Doe          | B       | 43    | 8
  Jane         | A       | 33    | 8
  Smith        | A       | 88    | 8
  Pat          | B       | 99    | 9
  </code></pre>
  
  <p>The output I desire is following for each class. So for class <code>8</code> it would be:</p>
  
  <pre><code>section  |  num_records | score_total
  ---------|--------------|-------------
  B        |   2          | 75
  A        |   2          | 121
  Total    |   4          | 196
  </code></pre>