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

select * from emp e where sal<
(select avg(sal) from emp where deptno=e.deptno)
order by deptno

Is This Answer Correct ?    20 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can you have more than one trigger on a table?

539


What are the different types of functions in sql?

523


What is data type in sql?

566


Is inner join faster than left join?

645


How to call shell script from pl sql procedure?

639






What is the usage of distinct keyword?

640


what is a composite key ? : Sql dba

616


List and explain the different types of join clauses supported in ansi-standard sql?

831


What are its different types of dbms?

548


what are myisam tables? : Sql dba

560


What is raid? How does it help storage of databases?

612


How can you load microsoft excel data into oracle? : aql loader

623


How would you pass hints to the sql processor?

537


how to rename an existing table in mysql? : Sql dba

584


What is Difference Between Unique and Primary Key Constraints?

615