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 |
Why do we use sql constraints? Which constraints we can use while creating database in sql?
how to see the oracle 9i/10g table in pc? or In my pc where the table is saved and how to see?
What is PL/SQL Records?
How do I run a script in sql developer?
what are the differences between char and nchar? : Sql dba
What is the difference between sql/pl-sql/embeded sql?
What are different methods to trace the pl/sql code?
What is ROWID?
Explain the significance of the & and && operators in pl sql.
Where is all the data on the internet stored?
Why is theta join required?
how to load data files into tables with 'mysqlimport'? : Sql dba
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)