I want to display the employees who have joined in last two
months. (It should be executed randomly means If I execute
the query in March it should display Jan and Feb joined
employees. Same query if i execute in Feb, 2007 it should
display dec, 2006 and jan 2007 joined employees.

Answer Posted / kesava

100% sure execute

select * from emp
where hiredate between
trunc(add_months(last_day(sysdate),-3)+1) and
trunc(add_months(last_day(sysdate),-1))

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we delete column in sql?

533


what are date and time functions in mysql? : Sql dba

518


Where do we use pl sql?

528


What is varray in pl sql?

541


What is sql keyword?

534






How do I count rows in sql query?

468


Is sql injection illegal?

570


list out some tools through which we can draw e-r diagrams for mysql. : Sql dba

488


What normalization means?

502


How do I add a primary key to a table?

522


write an sql query to find names of employee start with 'a'? : Sql dba

550


What is difference between sql and excel?

484


What is mutating error?

488


Does a join table need a primary key?

503


What is the difference between local and global temporary table?

529