how to retrieve the top 2 salaried persons from a database?
Answers were Sorted based on User's Feedback
Answer / abc
Select salary from (select salary from employees order by
salary desc) where rownum <=2;
Is This Answer Correct ? | 8 Yes | 1 No |
Answer / rajkumar
select top 1 colmn from table_name where colmn in
(select top 2 colmn from table_name where colmn is not
null order by colmn desc)
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / arun
select salary from(select salary from(select distinct salary from employees order by salary desc) where rownum<=2 order by salary) where rownum=1;
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / srinivas
select * from emp m
where
(select count(distinct sal)+1 from emp s
where s.sal>m.sal)<=2
order by sal desc
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / mamta
Select sal
from salary_tbl
where rownum <= 2
order by sal desc;
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / unknown
Select salary from (select salary from employees) where
rownum <=2;
Is This Answer Correct ? | 1 Yes | 7 No |
explain the difference between bool, tinyint and bit. : Sql dba
What is TABLE SPACE?
what is isam? : Sql dba
Why use subqueries instead of joins?
What is an exception in PL/SQL? What are the two types of exceptions?
Why is pl sql used?
What is trigger in sql? Explain
Explain the difference between rename and alias?
Explain locks? : Transact sql
Can you sum a count in sql?
How to revise and re-run the last sql command?
How to copy a table in another table with datas?