title: How to count occurrences of a column value efficiently in SQL?
body: <p>I have a table of students:</p>
  
  <pre><code>id | age
  --------
  0  | 25
  1  | 25
  2  | 23
  </code></pre>
  
  <p>I want to query for all students, and an additional column that counts how many students are of the same age:</p>
  
  <pre><code>id | age | count
  ----------------
  0  | 25  | 2
  1  | 25  | 2
  2  | 23  | 1
  </code></pre>
  
  <p>What's the most efficient way of doing this? <strong>I fear that a sub-query will be slow, and I'm wondering if there's a better way</strong>. Is there?</p>