title: Getting an average using SQL
body: <p>I recently struggled with this question on a test for a job.  I have the following table.</p>
  
  <pre><code>TABLE sessions
     id INTEGER primary key;
     userId INTEGER NOT NULL;
     duration INTEGER NOT NULL;
  </code></pre>
  
  <p>I needed to write a query that selected userID and the average duration for each user with more than 1 session.  In other words, I needed to average duration for all userIds that appeared more than once in the table.  Can anyone help me with this?</p>