6 kyu

SQL Basics: Create a FUNCTION (DATES)

3,599matt c

Description:

For this challenge you need to create a basic Age Calculator function which calculates the age in years on the age field of the peoples table.

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.

You may query the people table while testing but the query must only contain the function on your final submit.

people table schema

  • id
  • name
  • age

NOTE: Your solution should use pure SQL. Ruby is used within the test cases to do the actual testing.

SQL
Fundamentals

Stats:

CreatedOct 26, 2016
PublishedOct 26, 2016
Warriors Trained12187
Total Skips2608
Total Code Submissions49795
Total Times Completed3599
SQL Completions3599
Total Stars145
% of votes with a positive feedback rating80% of 425
Total "Very Satisfied" Votes299
Total "Somewhat Satisfied" Votes85
Total "Not Satisfied" Votes41
Total Rank Assessments8
Average Assessed Rank
6 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • matt c Avatar
  • Dentzil Avatar
  • Voile Avatar
Ad