Write a query to find five highest salaries from EMP table.
(there is a column SALARY)

Answer Posted / sreenivasreddy

SELECT ROWNUM, E1.*
FROM (SELECT EName, Deptno, Sal,
DENSE_RANK()
OVER(ORDER BY Sal DESC) EmpRank
FROM Emp
GROUP BY Deptno, EName, Sal
ORDER BY EmpRank) E1
WHERE E1.EmpRank <= 5
ORDER BY ROWNUM

Is This Answer Correct ?    6 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how to enter characters as hex numbers? : Sql dba

561


what are date and time data types? : Sql dba

529


define data blocks ? : Sql dba

536


Can you selectively load only those records that you need? : aql loader

601


Is a secondary key the same as a foreign key?

481






What is break?

609


How do I order columns in sql?

518


What language is oracle sql developer?

497


What is loop in pl sql?

563


What is offset and limit in sql?

543


Can we create table in function?

559


what are the maximum number of rows that can be constructed by inserting rows directly in value list? : Transact sql

489


How do I run a program in pl sql?

489


How to get list of all tables from a database?

615


What is java sql drivermanager?

539