title: Oracle ORDER BY with rownum or HAVING >= ALL
body: <p>My database teacher asked me to write (on Oracle Server) a query: select the groupid with the highest score average for year 2010</p>
  
  <p>I wrote:
  </p>
  
  <pre><code>SELECT * FROM (
      SELECT groupid, AVG(score) average FROM points
      WHERE yr = 2010
      AND score IS NOT NULL
      GROUP BY groupid
      ORDER BY average DESC
  ) WHERE rownum = 1;
  </code></pre>
  
  <p>My teacher tells me that this request is "better":</p>
  
  <pre class="lang-sql prettyprint-override"><code>SELECT groupid, AVG(score) average FROM points
  WHERE yr = 2010
  GROUP BY groupid
  HAVING AVG(score) &gt;= ALL (
      SELECT AVG(score) FROM points
      WHERE yr = 2010
      GROUP BY groupid
  );
  </code></pre>
  
  <p>Which one is the fastest/better ? Is there any better solution too (for Oracle only) ?
  Thanks.</p>