title: Returning subseted data in SQL with original data
body: <p>I have a database of students and teachers in a school and the marks scored in a subject in a single table. </p>
  
  <pre><code>Teacher | Student | Score
  
  Judy    | Jack    | 45
  Judy    | Jane    | 48
  John    | Jerry   | 37
  </code></pre>
  
  <p>I need an SQL query that returns the proportion of students who score > 40, grouped by teacher. </p>
  
  <p>I cant think of any efficient way of doing this, without using a temp table. </p>
  
  <p>Any suggestions? </p>