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

What are analytic functions in sql?

543


What are the ways on commenting in a pl/sql code?

509


Why are aggregate functions called so?

505


What is clustered index in sql?

582


What is meant by truncate in sql?

520






Can we join tables without foreign key?

518


How to display the records between two range in Oracle SQL Plus?

636


Are subqueries better than joins?

525


What is the advantage of index in sql?

532


What is a stored procedure in sql with example?

596


What are the string functions in sql?

523


How do you clear the screen in sql?

595


what are the advantages and disadvantages of views in a database? : Sql dba

528


How many row comparison operators are used while working with a subquery?

529


Show the two pl/sql cursor exceptions.

606