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 |
Which are the different types of indexes in sql?
Types of indexes. What is the default key created when a primary key is created in a table ?
Difference between SUBSTR and INSTR?
Which type of cursor is used to execute the dml statement?
Why is nosql good?
What does over partition by mean in sql?
How do you know if a relationship is 2nf?
How do you change a value in sql?
Why is the cursor important?
types of exceptions and what is meant by pragma autonomous_transaction ?what is the use.
What is pl sql commands?
What is multiple columns?