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 |
Can %notfound return null after a fetch?
How to take user input in pl sql?
What is the difference between Union and Union all. Which is faster.
What is the Query to print out the individual total number of duplicate row in sql.
What is blind sql injection?
How to maintain the history of code changes of pl/sql?
Difference between a query and strored procedure?
What is trigger in pl sql with examples?
Why you are not able to create a table using select command,if it is having a LONG column? for eg:create table test as select * from test1 here test1 containg a column having LONG datatype...
What are the parameter modes supported by pl/sql?
Can we insert in sql function?
What is exit statement?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)