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

Answers were Sorted based on User's Feedback



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

Answer / khushbu patel

select dept,count(emp),max(sal)
from a
where age < 25
group by dept
having max(sal) < 20000

Is This Answer Correct ?    11 Yes 2 No

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

Answer / vikneswaran thangarasu

Ignore my previous post. it is wrong.

select dept,count(emp),max(sal) from employee where age <25
group by dept having max(sal) <20000

Is This Answer Correct ?    3 Yes 0 No

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

Answer / priya

select dept,count(emp) from employee where age <25 and max
(sal) <20000 group by dept.

Is This Answer Correct ?    4 Yes 4 No

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

Answer / vikneswaran thangarasu

select dept,count(emp),max(sal) from employee where age <25
and sal <20000 group by dept

Is This Answer Correct ?    1 Yes 1 No

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

Answer / 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

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

Answer / nitin umale

SELECT department_id, COUNT(employee_id), MAX(salary)
FROM employees
WHERE MONTHS_BETWEEN(hire_date, SYSDATE) < 25*12
GROUP BY department_id
HAVING MAX(salary) < 20000;

Is This Answer Correct ?    3 Yes 6 No

Post New Answer

More SQL PLSQL Interview Questions

Define join and name different types of joins?

0 Answers  


What is Raise_application_error ?

1 Answers  


Are stored procedures faster than dynamic sql?

0 Answers  


What is time based sql injection?

0 Answers  


What are analytical functions in sql?

0 Answers  






What are the types of operators available in sql?

0 Answers  


What is diff between bulk collect and forall

3 Answers   Metric Stream,


What are the different types of joins and explain them briefly.

3 Answers  


Can we use views in stored procedure?

0 Answers  


Question: Below is the table city gender name delhi male a delhi female b mumbai male c mumbai female d delhi male e I want the o/p as follows: male female delhi 2 1 mumbai 1 1 Please help me in writing the query that can yield the o/p mentioned above?

2 Answers  


What is sql profiling in oracle?

0 Answers  


What does pragma mean?

0 Answers  


Categories