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
discuss about myisam key cache. : Sql dba
How do I quit sql?
What is the difference between left outer join and left join?
Explain what is a view?
Does truncate require commit?
Does view contain data?
What is snowflake sql?
What are inner outer left and right joins in sql?
What are local and global variables and their differences?
How much does a sql dba make? : SQL DBA
what is the difference between cluster and non cluster index? : Sql dba
What is the difference between distinct and unique in sql?
What is vector point function?
What is data profiling in sql?
What are the main features of cursor?