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 many joins can you have in sql?
How exception is different from error?
What is primary key secondary key alternate key candidate key?
List out the acid properties and explain?
What is full form of rtm?
What is pls_integer in pl sql?
How do I partition a table in sql?
What is count * in sql?
What is java sql driver?
Why commit is not used in triggers?
Does inner join remove duplicates?
The select into statement is most often used to create backup copies of tables or for archiving records?
What do you mean by stored procedures?
Is not null in sql?
Can I learn sql in a week?