How to find 6th highest salary from Employee table ?
Answers were Sorted based on User's Feedback
Answer / saravakumar
SELECT TOP 1 salary FROM (SELECT DISTINCT TOP 6 salary FROM
employee ORDER BY salary DESC) a ORDER BY salary
| Is This Answer Correct ? | 30 Yes | 8 No |
Answer / answer
SELECT MIN(SALARY) FROM EMPLOYEE WHERE SALARY IN (SELECT
DISTINCT TOP 6 MAX (SALARY) FROM EMPLOYEE ORDER BY SALARY
DESC)
| Is This Answer Correct ? | 16 Yes | 4 No |
Answer / rahul gupta
select sal from employee e1 where 5 = (select count(*) from
employee e2 where e1.sal < e2.sal)
| Is This Answer Correct ? | 5 Yes | 2 No |
Answer / lince thomas
select salary from(
select row_number() over(order by salary desc) as rno,*
from Employee)T where T.rno=6
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / lince
select * from(select salary,dense_rank() over(order by salary desc) as rno from emp)T where T.rno=6
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / vj
with cte as
(
select dense_rank() over (order by salary desc)
maxSal ,* from Employee )
select * from cte where maxSal=6
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / maheswar reddy s
select * from Employee e1 where 6=(select count(distinct(salary))from employee e2 where
e2.salary>=e1.salary)
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / krishan kant
SELECT MIN(SALARY) FROM EMPLOYEE WHERE SALARY IN (SELECT
DISTINCT TOP 6 SALARY FROM EMPLOYEE ORDER BY SALARY
DESC)
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / manikanta
select min(salary) as salary from Employee where salary >
(select min(salary)from employee)
| Is This Answer Correct ? | 1 Yes | 4 No |
write the query for taking database backup in sql
10 Answers ABC, IBM, Logica CMG, MA,
How will you know when statistics on a table are obsolete?
Explain about SQLOS?
how to change column into row in sql
Can I delete event logs?
how to insert the values in 5 table at a time Using any single statement ?
6 Answers Infosys, Value Labs,
what are file groups?
What is the simplest way to create a new database in ms sql server?
What is extent? Types of extents?
What is the difference between a stored procedure and a user defined function in sql server?
What is the default order of an order by clause?
What is co-related sub query?
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)