Which of the following is the correct method to find out the age of employees as on the current date, from their dates of birth given in the records?
Basis should be considered as actual
Answers
Answered by
1
Answer:
1st one from their dates of birth given in the record
Answered by
0
Answer:
Use datediff() function of SQL to find out the age of employees as on the current date, from their dates of birth given in the records.
In SQL(Structured Query Language), we have a pre-defined datediff() function that is used to find out the difference between the given date to the current date.
This function is very useful when you want to computer the age from the date of the birth of the person. It saves a lot of manual calculation time.
Use the below syntax to implement this function:
SYNTAX:
Select empyID, Ename, datediff( YY, birthDate, getdate()) as age from Employee;
It will give you the current age of all the employees who are present on the Employee table.
#SPJ2
Similar questions