Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


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

Answers were Sorted based on User's Feedback



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

Answer / yogesh sharma

SELECT ENAME,SALARY FROM (SELECT ENAME,SAL FROM EMP ORDER BY SALARY DESC ) WHERE ROWNUM<6;

Is This Answer Correct ?    77 Yes 13 No

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

Answer / priya

SELECT Rownum,emp-name,salary
FROM(SELECT emp_name,salary
FROM employees
ORDER BY salary Desc)
WHERE Rownum<=5;

Is This Answer Correct ?    16 Yes 3 No

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

Answer / sankarapandian

select top 5 salary from employee
order by salary desc

Is This Answer Correct ?    17 Yes 8 No

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

Answer / sarath

select ename,sal,SAlrank from(select ename,sal,dense_rank()
over(order by sal desc) Salrank from emp)
where salrank <=5

Is This Answer Correct ?    9 Yes 2 No

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

Answer / nitin umale

SELECT last_name, salary
FROM (select last_name, NVL(salary,0) salary
FROM employees
ORDER BY NVL(salary,0) DESC )
WHERE rownum<6;

Is This Answer Correct ?    9 Yes 3 No

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

Answer / 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

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

Answer / vishnu

select level,max(sal) from emp
where level<=5
group by level
connect by prior sal>sal
order by level Asc;

Is This Answer Correct ?    5 Yes 3 No

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

Answer / mk

SELECT ENAME,SALARY FROM (SELECT ENAME,SAL FROM EMP ORDER
BY SALARY DESC ) WHERE ROWNUM<6;

Is This Answer Correct ?    1 Yes 0 No

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

Answer / seetharam

select * from(select * from emp order by sal desc) where
rownum<=5;

Is This Answer Correct ?    3 Yes 3 No

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

Answer / amit bharane

select empid,salary
from (select empid,salary
from emp
order by sal desc)
where rownum <=5;

Is This Answer Correct ?    0 Yes 0 No

Post New Answer



More SQL PLSQL Interview Questions

What is the diffrence between IN and EXISTS.which one is faster.

3 Answers   Infogain,


Explain the working of foreign key?

0 Answers  


What is sql deadlock?

0 Answers  


what is the maximum length of a table name, database name, and fieldname in mysql? : Sql dba

0 Answers  


difference between cursor and procedure in a package

3 Answers   PCS,






what is collation? : Sql dba

0 Answers  


need to split a string into seperate values. eg. col1 col2 ---------- 100 - 'a,b,c' 200 - 'a,x,b,d,e' 300 - 'c' result: value count ------------- a - 2 b - 1 c - 2 etc.

1 Answers  


what is the use of HASH, LIST partitions?

1 Answers   ITC Infotech,


what is a tablespace? : Sql dba

0 Answers  


Is sql workbench free?

0 Answers  


What are local and global Indexes and where they are useful.

0 Answers  


What is mutating error in pl sql?

0 Answers  






Categories