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 use of trigger?
which will fire first ? Trigger or Constraint
24 Answers i2, IBM,
Why commit is not used in triggers?
If we have n no of columns in a table, can we add new column in that table with not null constraint?
What are % TYPE and % ROWTYPE ? What are the advantages of using these over datatypes?
How to return more than one value from a function?
Which one is the Best approach to put code, among Triggers and Procedures? Explain?
What are different clauses used in sql?
what command is used to create a table by copying the structure of another table including constraints ?
How can analyze query after generating explain plan ?
What is the source code of a program?
In table a 1lakh data is present,in table b 20 thousand data is present, to get unique data from table a and b which join to be considered. whether right outer join or left inner join.