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

What is dynamic SQl and how you will create and execute dynamic sql?

2 Answers   TCS,


What is the difference between jpql and sql?

0 Answers  


What is the primary use of normalization?

0 Answers  


Can a view be updated/inserted/deleted?If Yes under what conditions?

3 Answers  


What are the three pl sql block types?

0 Answers  






Where can I learn sql for free?

0 Answers  


What is dense_rank in sql?

0 Answers  


How do you define a foreign key?

0 Answers  


what are all types of user defined functions? : Sql dba

0 Answers  


How are multiple column = value pairs delimited in the SET clause of an UPDATE statement? 1. With commas (SET price = 0, status = 'I') 2. With parentheses (SET (price = 0) (status = 'I')) 3. With double-pipes (SET price = 0 || status = 'I') 4. With square-brackets (SET [price = 0] [status = 'I'] 5. With single or multiple spaces (SET price = 0 status = 'I')

2 Answers  


What is sql dialect?

0 Answers  


what is index? : Sql dba

0 Answers  


Categories