There is a table with emp salary column how to get the fields belongs to the salary greater than the average salary of particular department.
Write a query
Answers were Sorted based on User's Feedback
Answer / ram
SELECT * FROM emp e WHERE sal > (SELECT AVG(sal) FROM emp m
WHERE e.deptno = m.deptno GROUP BY deptno) ORDER BY deptno
gives u salary greater than the average salary of their
departments...
Is This Answer Correct ? | 22 Yes | 4 No |
Answer / murali krishna udayagiri
SELECT E.* FROM EMP E ,(SELECT DEPTNO,AVG(SAL) AVGSAL FROM
EMP GROUP BY DEPTNO) E1
WHERE E.SAL>E1.AVGSAL
AND E.DENPTNO=E1.DEPTNO;
Thanks,
Murali Udayagiri
Is This Answer Correct ? | 6 Yes | 2 No |
Answer / manoj
SELECT *FROM EMP WHERE SAL>(SELECT AVG(SAL) FROM EMP WHERE
DEPTNO=10);
this is correct answer. all the above answer are wrong except last one. Because in single row sub query we can't use group by clause. In all above queries they were used '>' simbol. So this is single row sub query matching operator.
Is This Answer Correct ? | 3 Yes | 0 No |
Answer / sameer
Select * from emplyees
Where sal>(select avg ( sal) from emplyees )
No need to write complex queries
Is This Answer Correct ? | 2 Yes | 1 No |
Answer / vivek singh
SELECT * FROM EMP WHERE SAL>(SELECT AVG(SAL) FROM EMP)
AND DEPTNO=10;
O/P:
7839 KING PRESIDENT 17-NOV-81 5000 10
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / lokesh y g
select e.no,e.name,e.salary from emp e where salary >
(select avg(salary)as salary from emp e1 where e.no=e1.no
group by no)
Is This Answer Correct ? | 1 Yes | 3 No |
Answer / sri
SELECT *FROM EMP WHERE SAL>(SELECT AVG(SAL) FROM EMP WHERE
DEPTNO=10);
Is This Answer Correct ? | 4 Yes | 6 No |
Can informatica load heterogeneous targets from heterogeneous sources?
How to recover the standalone session?
Differentiate between Load Manager and DTM?
What are the steps involved in the migration from older version to newer version of Informatica Server?
How to call shell scripts from informatica?
How do you convert single row from source into three rows into target?
Why the UNION TRANSFERMATION is an Active TRANSFERMATION
Sequence generator, when you move from develoment to production how will you reset
How would you copy the content of one repository to another repository?
how the data will be loaded while desiging the schema?which one first (for e.g.-dimesions and facts)
In which scenario did you used pushdown optimization?
Draw a workflow diagram for this situation. If s3 is true session s4 and s5 should concurreently Run.if any one s4 or s5 true it should run s1.If s1 sucess it should execute s2 otherwise exit.can any one give me suggestion.Thanks in advance.