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 / k.prashanth

Select
ename,sal,deptno
from emp
where sal in
(select max
(sal) from emp
where
level<=5
connect by
prior sal<sal
group by level)

Is This Answer Correct ?    0 Yes 0 No

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

Answer / manoranjan sethy

Method 01:
---------
Select Ename, MAX (Sal) From Emp
Group by ROWNUM, Ename
Having Rownum <=5;

Is This Answer Correct ?    0 Yes 0 No

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

Answer / vivek dubey

this Query is wrong : " SELECT ENAME,SALARY FROM (SELECT ENAME,SAL FROM EMP ORDER BY SALARY DESC ) WHERE ROWNUM<6; " because We can not use Order by clause in SubQuery.

This Answer gives you the right data :

"
SELECT TOP 5
empsal.ENAME,
empsal.SAL
FROM
(
SELECT ENAME,SAL
FROM EMP
) AS empsal
ORDER BY empsal.SAL DESC
"

Is This Answer Correct ?    0 Yes 0 No

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

Answer / ajay dond

select salary from (select distinct salary from employees
order by salary desc)
where rownum<6

Is This Answer Correct ?    0 Yes 0 No

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

Answer / ram

select ename,salary from(select ename,salary from emp order by salary desc) where rownumber<6

Is This Answer Correct ?    0 Yes 0 No

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

Answer / kishore

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

Is This Answer Correct ?    2 Yes 3 No

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

Answer / manjunath u

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

Is This Answer Correct ?    0 Yes 1 No

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

Answer / alex, n.y [microsoft]

SELECT TOP 5 [SALARY] FROM [EMP]

Is This Answer Correct ?    3 Yes 4 No

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

Answer / kavitha nedigunta

select a.*
from(select empno,ename,sal
from emp
order by sal desc nulls last)a
where rownum <6
order by sal desc

Is This Answer Correct ?    3 Yes 5 No

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

Answer / mohammad murtuza ali

select * from emp as(empname,empsal,empdesc) where rownum<6

Is This Answer Correct ?    1 Yes 4 No

Post New Answer

More SQL PLSQL Interview Questions

Why primary key is required?

0 Answers  


can we call a procedure into another procedure?If yes means how you can pass the perameters for the two procedures?

2 Answers   Fujitsu,


What are properties of the transaction?

0 Answers  


What is an invalid partition table?

0 Answers  


What is sql mysql pl sql oracle?

0 Answers  






what is a record in a database ? : Sql dba

0 Answers  


What are different types of indexes?

0 Answers  


What are the basic techniques of indexing?

0 Answers  


Determine if oracle date is on a weekend?

0 Answers  


What is oracle and pl sql?

0 Answers  


What are different types of keys?

0 Answers  


write a procedure to print a statement or number not using "dbms_output.put_line" package.write a procedure instead of it using procdure name as "print" ex:- declare a number:=2; begin print(a); end; /* when U type above procedure 2 have to should be printed*/

2 Answers   iFlex,


Categories