title: Database query for count
body: <p>I have one table with</p>
  
  <pre><code>ID  |   NAME    |   DEPT
  1   |   A       |   D-1
  2   |   B       |   D-1
  3   |   C       |   D-2
  4   |   D       |   D-3
  5   |   E       |   D-1
  6   |   F       |   D-3
  7   |   G       |   D-4
  </code></pre>
  
  <p>Now I want to fetch result like</p>
  
  <pre><code>DEPT    |   COUNT(DEPT)
  D-1     |   3
  OTHERS  |   4
  </code></pre>
  
  <p>Can any one help me to write this query?</p>