title: SQL find name of worker with maximum average score
body: <p>I am trying to display the name of the worker(s) with the largest average marks.
  My first table is the worker table and stores the worker_id and worker_name. The second table is the test table and stores the worker_id of who took the test, the test_id, and the marks.</p>
  
  <p>My goal is to be able to print the name of the worker who has the highest average marks across all tests. This is what I have so far:</p>
  
  <pre><code>    select max(avg_mark) as max_avg
      from (
          select worker_name, avg(mark) as avg_mark
          from worker join test worker.worker_id = test.worker_id
          group by worker_name
          order by avg(mark) desc);
  </code></pre>
  
  <p>However, this only returns the VALUE of the maximum average mark and not the name(s) of the worker(s) who have that average. If I add <code>worker_name</code> to the first select statement and also add a group by <code>worker_name</code> at the bottom then all the workers are returned with their averages!</p>