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

What is the difference between Union and Union all. Which is faster.

844


Could you please provide oca (oracle 10g) dumps for my certification ?

4512


What is constant in pl sql?

518


What is field delimiter?

634


Define the select into statement.

573






Is sql injection illegal?

596


What is rowtype?

565


How can you fetch first 5 characters of the string?

554


what are the different tables present in mysql, which type of table is generated when we are creating a table in the following syntax: create table employee (eno int(2),ename varchar(10)) ? : Sql dba

615


What is difference between nchar and nvarchar?

541


Explain cursor types?

580


what is collation? : Sql dba

615


Does truncate require commit?

543


How many types of literals are available in pl sql?

516


Write a sql query to find the names of employees that begin with ‘a’?

577