write the query for find the top 2 highest salary in sql
server
Answers were Sorted based on User's Feedback
Answer / kapil singh chauhan
select * from
(select ID,Salary from employee order by Salary desc)
where rownum < 3
| Is This Answer Correct ? | 4 Yes | 3 No |
Answer / karan
select empname,sal from empdpt e where 1=(select count(*) from
empdpt where e.sal<sal)
| Is This Answer Correct ? | 3 Yes | 2 No |
Answer / nilesh
select * from employee2 e where 2=(select count(distinct salary) from employee2
where e.salary<=salary)
Its working.
| Is This Answer Correct ? | 2 Yes | 1 No |
Answer / mohan c v
select min(salary) from
(select top 2 salary from emp order by salary desc) as a
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / priyanka
select salary from emp where rowno=3 order by sal desc.
but this query works only when you have to create index.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / ravi pahuja
selecl distinct top 2 salories from emp order by salory desc
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / girish
select max(salary) from emp where sal<(select max(salary)
from emp
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / chandan kumar
Select Top 1 salary from(select top 2 salary from emp_table
order by salary asc)
| Is This Answer Correct ? | 0 Yes | 0 No |
Differentiate between mongodb vs. Sql server?
Explain different types of Normalization.
1 Answers HPCL, Hughes Systique Corporation, Ittiam Systems,
What are database states in ms sql server?
Please differentiate between a local and a global temporary table?
What is correlated subquery in sql server?
Can group by and orderby be used together?
wat is the main diff between sql server 2000and sql server 2005
Why is sql server log file full?
What is perspective, have you ever created perspective? : sql server analysis services, ssas
hi, how to match retrieve the unmatched records from 2 tables in which we dont have any primary key. example : table1 has 1,2,3,4,5 and table2 has 1,2,3,4,5,6,7,8,9,10 and i want the numbers from 6 to 10 to be displayed and should not come as null. i need the numbers. please reply as soon as possible.
How to Debug a Stored Procedure?
What is function of ROLLUP ?
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)