title: Arithmetic operation on the subsets of results from a SQL groupby statement
body: <p>I have a schema with sex(m/f),state_name(all states of a country), student_name,and education (phd,ms).
  I use following query to return total males or females in each category of education for every state.</p>
  
  <pre><code>select sex,education,count(*) from mytable group by education,sex;
  </code></pre>
  
  <p>How can I write a query that returns the arithmetic ratio of (male divided by female) for each education in every state? </p>
  
  <p>I am trying to get to query that gives me gender ratio across education tiers for each state (I got count above, but I could not figure out how to do arithmetic division)</p>