write a query to find out the no. of employees whose age is
less than 25 and max of salary for the employees belonging
to a particular department is less than 20000

Answer Posted / pradeep

There is little mistake in Nitin the MONTHS_BETWEEN
(SYSDATE,hiredate)should be stated like this because if we
place hiredate firt the output comes in Negative, so it
gives all record.

select DEPTno,COUNT(EMPno),max(SAL)
from EMP
where (TO_CHAR(sysdate,'yyyy') - TO_CHAR(HIREDATE,'yyyy'))
< 25
GROUP BY DEPTno
having max(sal) < 20000

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

does sql support programming? : Sql dba

603


Is pl sql different from sql?

526


Are sql connections encrypted?

552


How can you create an empty table from an existing table?

589


Can a table have no primary key?

546






What is query syntax?

516


What is the sql query to display the current date?

547


What is coalesce in sql?

553


How many sql statements are used?

562


What is rtm in testing?

570


What are some predefined exceptions in pl/sql?

545


Can we rollback delete command?

509


What is the difference between joins?

530


How many types of cursors are available in pl/sql?

581


What are the different parts of a package?

625