title: MySQL select males and females under 21
body: <p>How would I split males and females and count those under 21?</p>
  
  <p><img src="https://i.stack.imgur.com/DoVmg.png" alt="enter image description here"></p>
  
  <p>So far I have this (but the values are not correct):</p>
  
  <pre><code>SELECT 
      COUNT( if(gender='M', 1, 0) ) AS males, 
      COUNT( if(gender='F', 1, 0) ) AS females 
  FROM 
      dependent
  WHERE 
      YEAR(CURRENT_TIMESTAMP) - YEAR(dob) - (RIGHT(CURRENT_TIMESTAMP, 5) &lt; RIGHT(dob, 5)) &lt; 21
  </code></pre>
  
  <p>output should be like this:</p>
  
  <p>Males | Females</p>
  
  <p>1 | 2</p>