consider a table which contain 4 columns,ename,eno,sal and
deptno, from this table i want to know ename who having
maximum salary in deptno 10 and 20.
Answer Posted / vishnu prasad.ma
SELECT A.EMP_NAME, SUM(B.MAX_SALARY) AS MAX_SAL, B.EMP_DEPT_NO FROM EMP_DETAILS A,
(SELECT MAX(EMP_SAL) AS MAX_SALARY, EMP_DEPT_NO FROM EMP_DETAILS WHERE EMP_DEPT_NO IN (10,20)
GROUP BY EMP_DEPT_NO) B
WHERE
A.EMP_SAL = B.MAX_SALARY
AND A.EMP_DEPT_NO = B.EMP_DEPT_NO
GROUP BY A.EMP_NAME, B.EMP_DEPT_NO
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How to display the current date in sql?
What is the current version of postgresql?
What is inner join in sql?
explain the difference between delete , truncate and drop commands? : Sql dba
What is normalisation in sql?
What is set serveroutput on?
what is the difference between char and varchar data types? : Sql dba
What is a common use of group by in sql?
Is primary key an index?
How do you modify a trigger?
What are different types of sql?
How can I change database name in sql?
How many sql statements are used? Define them.
What is range partitioning?
- 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?