How to find 6th highest salary from Employee table ?

Answers were Sorted based on User's Feedback



How to find 6th highest salary from Employee table ?..

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

How to find 6th highest salary from Employee table ?..

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

How to find 6th highest salary from Employee table ?..

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

How to find 6th highest salary from Employee table ?..

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

How to find 6th highest salary from Employee table ?..

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

How to find 6th highest salary from Employee table ?..

Answer / anto

select distinct top6 salary from employee

Is This Answer Correct ?    2 Yes 2 No

How to find 6th highest salary from Employee table ?..

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

How to find 6th highest salary from Employee table ?..

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

How to find 6th highest salary from Employee table ?..

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

How to find 6th highest salary from Employee table ?..

Answer / manikanta

select min(salary) as salary from Employee where salary >
(select min(salary)from employee)

Is This Answer Correct ?    1 Yes 4 No

Post New Answer

More SQL Server Interview Questions

If a stored procedure is taking a table data type, how it looks?

1 Answers  


An employee table, with the columns id, name, sal and dob. Query to select emp names of all highest salaries(there are 4-5 people having the same salary which happens to be the highest).

9 Answers   ADP,


What is the process of indexing?

0 Answers  


What are the all different types of Joins in SQL Server 2000, Anybody can explain each join with definition..Thanks in advance....

9 Answers   DELL, i Tech, Infosys, Siemens, TCS,


i need to know how i display department which has salary > =5000 for the below table Department ----------- salary deptname 1000 a 3000 a 2000 b 3000 b 4000 c 5000 c kindly send the query to thilakvinoth13@gmail.com

6 Answers  






how can you attach more than 20 ldf files in sql server

0 Answers   IBM,


Explain cdc and sql injection?

0 Answers  


What specific conditions database should meet, before you can bulk copy data into it using bcp?

0 Answers  


how to copy sysdatabase file from c: Drive to D: Drive in SQL Server.

6 Answers   IBM,


Can I know,how to Execute Funcion and Trigger through command(Manualy Execution) in MS SQL/SERVER 2005,give me answer with Example.

1 Answers  


Why union all is faster than union?

0 Answers  


What is the sql case statement used for?

0 Answers  


Categories