SQL Display Database on Age Range

advertisements

I'm using an Oracle database.

What do I have to do to print all data within the age range of 21 to 40?

CREATE TABLE    EMPLOYEE(
  ENum      varchar2(10)    not null,
  EName     varchar2(70),
  EDOB      date,
  ECity     varchar2(70),
  EStreet       varchar2(70),
  EHouse#            varchar2(10),

  constraint employee_pkey primary key (ENum)
);

I have a rough idea which look like this, but I know it's wrong because AGE is not a valid identifier. So should I use Select Case instead?

SELECT * FROM EMPLOYEE
WHERE Age = ((sysdate - EDOB)/365.25)
AND EDOB BETWEEN 21 and 40;


try this

where ((sysdate - edob)/365.25) between 21 and 40