title: How to calculate age from date of birth and group each member into age range in sql
body: <p>I have an sql table that stores people's details i.e id, name, DoB, registration_date and address. I would like to calculate the age of each individual and then group them into these ranges: 20-30, 31-50, 51 &amp; over.</p>
  
  <p>I know i can get the age by doing: (<a href="https://stackoverflow.com/a/1572257/3045800">https://stackoverflow.com/a/1572257/3045800</a>)</p>
  
  <pre><code>SELECT FLOOR((CAST (GetDate() AS INTEGER) - CAST(Date_of_birth AS INTEGER)) / 365.25) AS Age
  </code></pre>
  
  <p>I just need to figure out how to group all people into thier respective range.</p>
  
  <p>Thanks for the help</p>