i have a table
eno dno sal
1 10 200
2 10 150
3 10 100
4 20 75
5 20 100

i want to get sal which is less than the avg sal of thri dept.

eno dno sal
2 10 150
3 10 100
4 20 75

Answer Posted / mohan

SELECT dno,sal
FROM EMP
WHERE sal>ANY(SELECT AVG(sal)
FROM emp
GROUP BY dno)
ORDER BY dno;

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is postgresql a server?

573


what tools available for managing mysql server? : Sql dba

529


What can I use instead of union in sql?

511


What are the steps for performance tuning.

837


What is scalar and vector?

528






How sql query is executed?

550


What is the most restrictive isolation level? : Transact sql

554


Is drop table faster than truncate?

547


How many columns should be in an index?

518


Which join is like an inner join?

523


explain mysql aggregate functions. : Sql dba

545


What are % type and % rowtype?

570


what are set operators in sql? : Sql dba

534


How to write html code in pl sql?

580


What is an exception in PL/SQL? What are the two types of exceptions?

622