How to retrieve employees whose birth date is between 1992 to 1996 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to retrieve employees whose birth date is between 1992 to 1996

5th Sep 2017, 6:09 AM
Dnyaneshwar B.Gaikwad
Dnyaneshwar B.Gaikwad - avatar
5 Answers
+ 6
select * from employee where year (birthdate) between 1992 and 1996 ; //this was method 1 ☺ select * from employee where year (birthdate)>=1992 and year (birthdate)<=1996 ; // this was method 2 //note : in method 1 also , between will include 1992 and 1996 too //hope it helps ☺
5th Sep 2017, 7:52 AM
Changed
Changed - avatar
+ 1
if full birthdate is ustored in the form 1-12-1993 then
5th Sep 2017, 6:34 AM
Dnyaneshwar B.Gaikwad
Dnyaneshwar B.Gaikwad - avatar
0
SELECT * FROM EMPLOYE WHERE Birthdate <= 1996 AND Birthdate >= 1992;
5th Sep 2017, 6:25 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
0
Then replace Birthdate by CONVERT( TO_CHAR( Birthdate, 'YYYY' ), NUMBER )
5th Sep 2017, 7:01 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
0
Select * from employe where birthdate between '1-1-1992' and '31-12-1996'; Maybe :-)
5th Sep 2017, 4:02 PM
Jelena Mikolasek
Jelena Mikolasek - avatar