Answer Posted / neetika vardhan
SELECT DEPT, MAX(SAL)
FROM EMP
WHERE SAL NOT IN (SELECT MAX(SAL) FROM EMP GROUP BY DEPT)
GROUP BY DEPT
UNION
SELECT DEPT, MAX(SAL)
FROM EMP
GROUP BY DEPT
UNION
SELECT DEPT, MAX(SAL)
FROM EMP
WHERE SAL NOT IN
(SELECT MAX(SAL)
FROM EMP
WHERE SAL NOT IN (SELECT MAX(SAL) FROM EMP GROUP
BY DEPT)
GROUP BY DEPT
UNION
SELECT MAX(SAL) FROM EMP GROUP BY DEPT)
GROUP BY DEPT
| Is This Answer Correct ? | 0 Yes | 6 No |
Post New Answer View All Answers
What is file based approach?
What is the command used to fetch first 5 characters of the string?
Can we write dml inside a function in sql server?
how to check myisam tables for errors? : Sql dba
Explain mutating table error.
If i can use sys.check_constraints to display my constraints from my database using sql server 2005, how can i display then if i am using sql server 2000????
Explain how to use transactions efficiently : transact sql
Can we want to pass a parameter payroll_id to this external pl/sql function, how do we do it?
What is nvl?
What are the benefits of triggers?
What is a string data type in sql?
What are synonyms in sql?
what happens if null values are involved in expressions? : Sql dba
Is join and inner join the same?
What is the difference between a query and a report?