How do i do a where clause to check the age show below when i don’t have an age field to check it against? I’m using oracle DB.
select LNAME || ', ' || FNAME as "Name",
TO_CHAR(sysdate,'YYYY') - TO_CHAR(DOB,'YYYY') as AGE
from STAFF
where AGE = (select min(TO_CHAR(sysdate,'YYYY') - TO_CHAR(DOB,'YYYY'))
from STAFF);
Here’s some example on existing Oracle table:
You may also add analytic functions to partition by age or any other field for example or simply order by age asc to see all emps in output removing where…