Tuesday, February 20, 2024

Getting the age of employees from their birthdate in sql

 SELECT
FirstName,
LastName,
Address,
FirstName ||' '|| LastName || ' ' || Address ||','|| City ||' '||State ||' '||PostalCode as [Mailing Address],
length(PostalCode),
substr(PostalCode,1,5) as [5 digit postal code],
upper(FirstName) as [First Name all caps],
lower(LastName) as [Last Name all lower],
strftime('%Y-%m-%d',BirthDate) as [BirthDate without time code],
strftime('%Y-%m-%d','now')-strftime('%Y-%m-%d',BirthDate) as age
from Employee


No comments:

Post a Comment