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 |
What is type and rowtype in pl sql?
What are the benefits of pl sql?
display null value rows with out using null function?
one of the column in my table contains the data like SAL ---- 1000 1000 2000 3000 3000 So my requirement is i want output like SAL --- 1000 2000 3000 it mean i want to delete duplicate rows only how should u write query?
Why does %isopen return false for an implicit cursor?
What is cursor and its types?
How do I create a memory optimized filegroup?
What do you mean by field in sql?
Why does sql need a server?
can we write stored function in out parameters? how to call through select statement? how to written more than one value plz give the exmple?
what is 'mysqldump'? : Sql dba
What is string join?