SQL: Below SQL will give the age of an employee based on the birthdate.




select trunc((to_number(to_char(sysdate,'yyyymmdd'))-to_number(to_char(BIRTHDATE,'yyyymmdd')))/10000) AGE, BIRTHDATE from PS_DEP_BEN WHERE EMPLID = '6508';

Comments