title: Query to Find company name where salary than 4000
body: <p>I have three tables <code>company</code>, <code>employee</code> and <code>salary</code> and I want to a query to print the names of every company where the average salary is greater than or equal to 4000 grouped by company.name</p>
  
  <p>Salary table has <code>empployee_id, company_id and salary</code></p>
  
  <p>I tried this but I am not sure this is right. I am new to sql.</p>
  
  <pre><code>select COMPANY.NAME, avg(SALARY.SALARY)
  from COMPANY C join
       SALARY S
       on C.ID = S.ID 
  group by C.NAME
  having avg(S.SALARY) &gt;= 4000
  </code></pre>