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

select department_id,salary from employees e 
where salary<(select trunc(avg(salary)) 
from employees where department_id=e.department_id;

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain how to use transactions efficiently : transact sql

714


What are tables in sql?

737


How many types of cursors are available in pl/sql?

770


how many tables will create when we create table, what are they? : Sql dba

764


How to use sql*plus built-in timers?

764






How do I count rows in sql query?

688


list out some tools through which we can draw e-r diagrams for mysql. : Sql dba

699


How would you pass hints to the sql processor?

704


How to set up sql*plus output format in oracle?

772


who introduced sql?

752


How to run sql*plus commands in sql developer?

798


What does pragma mean?

708


Is sqlexception checked or unchecked?

723


Why do we need view in sql?

728


How would you convert date into julian date format?

789