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 / subbu
select e.eno,e.dno,e.sal
from emp_t e,
(select dno,avg(sal) avgsal from emp_t group by dno) b
where e.sal<b.avgsal and e.dno=b.dno
/
| Is This Answer Correct ? | 5 Yes | 4 No |
Post New Answer View All Answers
What is the difference between the implicit and explicit cursors?
How do I view a view in sql?
Write a sql query to convert all character to uppercase after hypen.
what is a table in a database ? : Sql dba
how many triggers are allowed in mysql table? : Sql dba
What is form and report?
What is gpt format?
What are all types of user defined functions?
How do you truncate?
Enlist the advantages of sql.
Mention what is the use of function "module procedure" in pl/sql?
what is a unique key ? : Sql dba
Table 1: col1 Timestamp ---------------- 01-mar-2012 11:12:46 Table 2: col2 Timestamp -------------------- 01-mar-2012 11:12:10 01-mar-2012 11:11:23 Write a query to display a row with table2 col2 value less than tabl1 col1 value. Maximum timestamp value previous to table1 col1 value. Display a result as: Col1 col2 ----- ----- 01-mar-2012 11:12:46 01-mar-2012 11:12:10
what is primary key? : Sql dba
What is the most important ddl statements in sql are?