title: Finding the highest average salary in SQL
body: <p>I have two tables which are prof and dept. What I want to do is find the dept with the highest average salary.</p>
  
  <p>The two table structure are are as below</p>
  
  <p>prof </p>
  
  <pre><code>id name dept_id salary
  1    x    3      20999
  2     y   1      09000
  3    z    2      10000
  4   a     2      20000
  </code></pre>
  
  <p>dept</p>
  
  <pre><code>id dept_name
  1  buk
  2  rul
  3  lok
  </code></pre>
  
  <p>sample output</p>
  
  <pre><code>dept.name avg.salary
  buk       10000
  rul       15000
  lok       20999
  </code></pre>
  
  <p>I have combined the two tables but unable to find the average using the two tables.</p>
  
  <pre><code>select department.name,professor.salary from professor , department where professor.id = department.id;
  </code></pre>