title: How to calculate age in years in SQL
body: <p>Need to create a basic Age Calculator function which calculates the age in years on the age field of the peoples table.</p>
  <blockquote>
  <p>The function should be called agecalculator, it needs to take 1 date and calculate the age in years according to the date NOW and must return an integer.</p>
  <p>You may query the people table while testing but the query must only contain the function on your final submit.</p>
  </blockquote>
  <p>people table schema</p>
  <pre><code>id
  name
  age
  </code></pre>
  <p>This is my code:</p>
  <pre><code>select convert(int,DATEDIFF(d, '1933-10-31', getdate())/365.25)
  </code></pre>