how to retrieve the top 3 salaries of the table using rownum
Answer Posted / rajnish chauhan
you can put any number on Rnk.
---Top 3 salary
SELECT ROWNUM,ename,sal
FROM (
SELECT ename,sal,rank() over(ORDER BY sal DESC)rnk
FROM emp)a WHERE rnk<4
-----Top 3 Salary only
SELECT ROWNUM,ename,sal
FROM (
SELECT ename,sal,rank() over(ORDER BY sal DESC)rnk
FROM emp)a WHERE rnk=3
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How many types of keys are there in sql?
What is pl sql script?
How delete a row in sql?
What is the location of pre_defined_functions.
What is coalesce sql?
what is sql in mysql? : Sql dba
Why use stored procedures?
What is a full join?
write an sql query to get third maximum salary of an employee from a table named employee_table. : Sql dba
What are the different dml commands in sql?
What is set transaction?
How do I create a memory optimized filegroup?
How to call shell script from pl sql procedure?
What are the methods of filing?
What are the different types of functions in sql?