GeekInterview.com
Series: Subject: Topic:
Question: 88 of 214

Query to find the list of employees age > 30

Write a query to find the list of employees whos age is greater than 30 or so given a date of birth column
Asked by: rekssql | Member Since Jan-2007 | Asked on: Jan 11th, 2007

View all questions by rekssql   View all answers by rekssql

Showing Answers 1 - 11 of 11 Answers
Savitha

Answered On : Jan 12th, 2007

SELECT SSN,ENAME

FROM EMP

WHERE DATEDIFF(YEAR, DOB, GETDATE())>30

  
Login to rate this answer.

I wanted query in oracle sql syntax.

  
Login to rate this answer.
Vinayak

Answered On : Jan 17th, 2007

Select ename
from emp
where trunc(sysdate-emp.dob) > 30
/

  
Login to rate this answer.
ggk.krishna

Answered On : Feb 12th, 2007

Hai,SELECT ENAME FROM EMPWHERE ROUND(MONTHS_BETWEEN(SYSDATE,EMP_DOB)/12)>30I think this will work for you. If not give reply.

  
Login to rate this answer.
Srikanth

Answered On : Mar 12th, 2007


       select FNAME,MNAME,LNAME,BDATE
                  
        FROM EMPLOYEE

        WHERE age>30;

  
Login to rate this answer.
tomtwj

Answered On : Mar 16th, 2007

View all answers by tomtwj

 select   empno, BIRTHDate
 from scott.emp
 where trunc( sysdate,'YEAR') - trunC( BIRTHDate, 'YEAR') > 30

  
Login to rate this answer.
Lavanya Chowdary

Answered On : May 6th, 2007

For example if emp table has dob (date of birth) column the query is
SELECT * FROM EMP
WHERE months_between(sysdate,dob)/12>30;

Yes  1 User has rated as useful.
  
Login to rate this answer.

SQL> SELECT ename FROM emp WHERE round(months_between(sysdate,DOB)/12)>=30;

 
This query will work fine as one of the user mentioned this already....

  
Login to rate this answer.
tapasgaan

Answered On : Nov 9th, 2010

View all answers by tapasgaan

select employeename from employee
where trunc(months-between(sysdate,dob)/12, 0) >= 30

  
Login to rate this answer.



      SELECT *,DATEDIFF(YY,,GETDATE()) AS AGE FROM WHERE DATEDIFF(YY,,GETDATE()) > 30




  Thanks & Regards
  K.santhosh

  
Login to rate this answer.
maninder singh

Answered On : Apr 9th, 2012

Please tell me,
How to get age of all employee by using query

  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Ads

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.