Help with Transact-SQL [closed]

-5

Design with code in T-SQL language a block of instructions that calculates the average age of employees, and show us a message by console indicating whether the average exceeds 50 years of age or not.

employees table

Someone tells me how I get the age ...

    
asked by ortiga 01.12.2018 в 14:30
source

1 answer

1

For this you need to support yourself in a function called DATEDIFF , which receives 3 parameters, initial age, final age and the data you need (year, day, month, etc.).

SELECT *, --  Las columnas de tu tabla
    DATEDIFF(YEAR, BirthDate, GETDATE())  --  El cálculo
FROM TABLA
    
answered by 01.12.2018 / 14:41
source