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

select sal from demo where sal<(select avg(sal) from demo
where eno in (2,3,4));

NOTE:first create table demo and insert all these 5 rows
then run querry.
If any issue call me(PRASANT)

Is This Answer Correct ?    4 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of triggers?

736


What are the different types of sql commands?

781


what is the difference between rownum pseudo column and row_number() function? : Sql dba

810


- Types of triggers - View - Dcl - Procedures, packages, functions - Metasolve - Can use Dcl in triggers - package case study - Cursor and its types - triggers schedule - Wrap - Why we are using fetch and for in cursor. difference?

1579


Can we use rowid as primary key?

735






Explain the select statement in sql?

823


What is data type in database?

726


What is recursive stored procedure?

809


What is an inner join sql?

694


What is the function that is used to transfer a pl/sql table log to a database table?

730


How do I write a cron which will run a sql query and mail the results to agroup?

713


what is the difference difference between procedure and packages

9649


what is auto increment? : Sql dba

742


What is view? Can we update view

1081


Can a view be mutating? If yes, then how?

750