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

What are the different parts of a package?

631


Can triggers stop a dml statement from executing on a table?

614


Which is faster count (*) or count 1?

538


how can you see all indexes defined for a table? : Sql dba

537


What is meant by <> in sql?

503






How do I find duplicates in a single column in sql?

534


What are the events on which a database trigger can be based?

592


What is cascade in sql?

559


how to convert dates to character strings? : Sql dba

537


What are joins in sql?

534


What are the string functions in sql?

526


What is the purpose of a secondary key?

506


What does sign mean sql?

568


How do I run a sql query in pgadmin 4?

546


What is int identity in sql?

572