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

Questions by rekssql   answers by rekssql

Showing Answers 1 - 52 of 52 Answers

Savitha

  • Jan 12th, 2007
 

SELECT SSN,ENAME

FROM EMP

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

  Was this answer useful?  Yes

Vinayak

  • Jan 17th, 2007
 

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

  Was this answer useful?  Yes

ggk.krishna

  • 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.

  Was this answer useful?  Yes

Srikanth

  • Mar 12th, 2007
 


       select FNAME,MNAME,LNAME,BDATE
                  
        FROM EMPLOYEE

        WHERE age>30;

  Was this answer useful?  Yes

tomtwj

  • Mar 16th, 2007
 

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

  Was this answer useful?  Yes

Lavanya Chowdary

  • 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;



      SELECT *,DATEDIFF(YY,<JOINING DATE>,GETDATE()) AS AGE FROM <TABLE_NAME> WHERE DATEDIFF(YY,<JOINING DATE>,GETDATE()) > 30




  Thanks & Regards
  K.santhosh

  Was this answer useful?  Yes

maninder singh

  • Apr 9th, 2012
 

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

  Was this answer useful?  Yes

Ivo

  • Jan 26th, 2017
 

Works great with SQL Server! Thanks!

  Was this answer useful?  Yes

yashwanth K S

  • Apr 4th, 2017
 

Code
  1. SELECT SSN,ENAME

  2. FROM EMP

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

  Was this answer useful?  Yes

sreelatha

  • May 17th, 2017
 

Code
  1. SELECT *

  2. FROM employee

  3. WHERE age>30;

  Was this answer useful?  Yes

nisha

  • Jul 7th, 2017
 

Select * from table where ((sysdate-DOB)/365)>30;

  Was this answer useful?  Yes

mukund

  • Sep 7th, 2017
 

SELECT `First_Name`, SYSDATE(), `Date_Of_Birth`, DATEDIFF( SYSDATE(), `Date_Of_Birth` )/365
FROM `members` WHERE (DATEDIFF( SYSDATE(), `Date_Of_Birth` )/365)>15;

  Was this answer useful?  Yes

Piyush Kumar

  • May 4th, 2019
 

Curdate() will give you the current date. here we are subtracting from dob to current date(year).

Code
  1. SELECT * FROM USER WHERE (YEAR(CURDATE()) - YEAR(DOB))>30;

  Was this answer useful?  Yes

Shailesh Bhilare

  • Dec 6th, 2021
 

There is a table employee (empid,empname,DOB). Get the emp count against the age bracket of less than or equal to 30 and above 30.
Could you pls give the oracle syntax for tge above Query..?

  Was this answer useful?  Yes

Give your answer:

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

 

Related Answered Questions

 

Related Open Questions