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

Answers were Sorted based on User's Feedback



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

Answer / parth

select salary from eno where salary<(select avg(salary)
from eno ) and rownum < 6

Is This Answer Correct ?    0 Yes 3 No

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

Answer / vin

select * from emp group by deptno having sal < avg(sal)

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More SQL PLSQL Interview Questions

Can I create table without primary key?

0 Answers  


what is the difference between $message and $$message? : Sql dba

0 Answers  


how to insert values like 10:10:00,30:25:00 etc.into table after insert how can i sum the above insert values to get the result as 40:35:00

3 Answers  


What is a subquery in sql?

0 Answers  


How we get all_group_function's(Sum,avg,count,max and min_value of a column(Sal) Using pl/sql anonymous block, with out using group function's. You shouldn't use more than one select statement in entire the program. Like cursor c is select * from <table_name>; except this you can't use another select statement. You can use no of variables as per requirement.

1 Answers  






Hi am new to PLSQL & facing problems in writing code like in SP, Functions, so any one having some SP coding with in depth explanation please share with me my Email ID suvarnaatsuvarna@rediffmail.com Or taking tanning on this please do contact me

0 Answers  


How to use sql*plus built-in timers?

0 Answers  


what is log shipping? : Sql dba

0 Answers  


How do you write a complex sql query?

0 Answers  


What is integrity in sql?

0 Answers  


how would you get the current date in mysql? : Sql dba

0 Answers  


Is clustered index a primary key?

0 Answers  


Categories