Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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

How many joins can you have in sql?

0 Answers  


How do you change a value in sql?

0 Answers  


What are the conditions an underlying table must satisfy before a cursor can be used by a positioned update or delete statement? : Transact sql

0 Answers  


how to check the 3rd max salary from an employee table? One of the queries used is as follows: select sal from emp a where 3=(select count(distinct(sal)) from emp b where a.sal<=b.sal). Here in the sub query "select count(distinct(sal)) from emp b where a.sal<=b.sal" or "select count(distinct(sal)) from emp b where a.sal=b.sal" should reveal the same number of rows is in't it? Can any one here please explain me how is this query working perfectly. However, there is another query to get the 3rd highest of salaries of employees that logic I can understand. Pls find the query below. "select min(salary) from emp where salary in(select distinct top 3 salary from emp order by salary desc)" Please explain me how "select sal from emp a where 3=(select count(distinct(sal)) from emp b where a.sal<=b.sal)" works source:http://www.allinterview.com/showanswers/33264.html. Thanks in advance Regards, Karthik.

4 Answers  


Hello All, Could any well write a query for the following scenario. Account(table name) No Name Amount 1 ABCD 2000.00 2 DEFG -2000.00 3 GHIJ 3000.50 4 JKLM 4000.00 5 MNOP 6000.00 O/p Should be in this format No Name Credit Debit 1 ABCD 2000.00 0 2 DEFG 0 -2000.00 3 GHIJ 3000.50 4 JKLM 0 -4000.00 5 MNOP 6000.00 o could any one give appropriate query for this Thnks in Advance Suneel Reddy

6 Answers   Target,


How do I start pl sql?

0 Answers  


what is user defined functions? : Sql dba

0 Answers  


What are sql data types?

0 Answers  


what is self join and how it works??

2 Answers   Infosys,


What is a schema sql?

0 Answers  


What is the difference between the sql*loader and import utilities? : aql loader

0 Answers  


display records from 5 to 9 using rowid or rownum

5 Answers   Agile Software,


Categories