title: sql average items per user without being given the counts
body: <p>If a table has bogos in it and each bogo's columns are like: bogo_id, user_id, baga_id, and the relationship between users and bagas is many to many, how to write an sql statement that finds the median number of bagas per user? </p>
  
  <h2>sample data:</h2>
  
  <ul>
  <li>user_id | baga_id</li>
  <li>1          1</li>
  <li>1          1</li>
  <li>1          1</li>
  <li>1          1</li>
  <li>2          1</li>
  <li>3          1</li>
  <li>1          2</li>
  </ul>
  
  <h2>Expected output:</h2>
  
  <ul>
  <li>baga_id    |  median per user</li>
  <li>1              1</li>
  <li>2              0</li>
  </ul>