title: Using AVG() in Oracle SQL
body: <p>I have a table named Student as followed:</p>
  
  <pre><code>CREATE TABLE  "STUDENT" 
  (   "ID" NUMBER(*,0), 
      "NAME" VARCHAR2(20), 
      "AGE" NUMBER(*,0), 
      "CITY" VARCHAR2(20), 
      PRIMARY KEY ("ID") ENABLE
  )
  </code></pre>
  
  <p>I am trying to get all the records of the students having a larger age than the average age. This is what I tried:</p>
  
  <pre><code>SELECT *
  FROM student
  WHERE age &gt; AVG(age)
  </code></pre>
  
  <p>and</p>
  
  <pre><code>SELECT * 
  FROM student
  HAVING age &gt; AVG(age)
  </code></pre>
  
  <p>Both ways did not work! </p>