title: PostgreSQL equivalent for MySQL GROUP BY
body: <p>I need to find duplicates in a table. In MySQL I simply write:</p>
  
  <pre><code>SELECT *,count(id) count FROM `MY_TABLE`
  GROUP BY SOME_COLUMN ORDER BY count DESC
  </code></pre>
  
  <p>This query nicely:</p>
  
  <ul>
  <li>Finds duplicates based on SOME_COLUMN, giving its repetition count.</li>
  <li>Sorts in desc order of repetition, which is useful to quickly scan major dups.</li>
  <li>Chooses a random value for all remaining columns, giving me an idea of values in those columns.</li>
  </ul>
  
  <p>Similar query in Postgres greets me with an error:</p>
  
  <blockquote>
    <p>column "MY_TABLE.SOME_COLUMN" must appear in the GROUP BY clause or be
    used in an aggregate function</p>
  </blockquote>
  
  <p>What is the Postgres equivalent of this query?</p>
  
  <p>PS: I know that MySQL behaviour deviates from SQL standards.</p>