title: Counting distinct items within a category on SQL
body: <p>I need to compose a SQL statement as follows:</p>
  
  <p>I have a table with many items, each item having a category. In total there are 3 categories.</p>
  
  <p>I need to select the DISTINCT categories and then order them by number of items within each category.</p>
  
  <p>Would this be a good way? Or too slow?</p>
  
  <pre class="lang-sql prettyprint-override"><code>SELECT DISTINCT category, count(*) AS counter
  FROM item_descr
  GROUP BY category
  ORDER BY counter DESC
  </code></pre>