Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


write query for fourth maximum salary from employee table

Answers were Sorted based on User's Feedback



write query for fourth maximum salary from employee table..

Answer / ilgian

select min(salary)
from (
select top 4 *
from employees
order by salary desc
) as a

Is This Answer Correct ?    24 Yes 7 No

write query for fourth maximum salary from employee table..

Answer / arun kumar

select top 1 e.emp_code,e.emp_name,ed.basic_salary from
employee_master e, employee_salary_detail ed where
e.emp_id=ed.emp_id order by basic_salary desc

Is This Answer Correct ?    4 Yes 2 No

write query for fourth maximum salary from employee table..

Answer / anish tuladhar

select
distinct salary
from
(
select
DENSE_RANK() over(order by salary desc) as rnk,
modelyr_id_int
from
employee
) a
where
rnk = 4

Is This Answer Correct ?    2 Yes 0 No

write query for fourth maximum salary from employee table..

Answer / raman

select top 1(esal) from (select top 2(esal) from employee order by esal desc) employee order by esal asc

Is This Answer Correct ?    1 Yes 0 No

write query for fourth maximum salary from employee table..

Answer / ajay roy

The Correct answer is ---

select salary from employee aa
where 4=(select count(*)from employee bb
where aa.salary<=bb.salary)

Thanks Elumalai.k

Top Keyword returns the top(first) row not the max record

Is This Answer Correct ?    1 Yes 0 No

write query for fourth maximum salary from employee table..

Answer / yogendra barode

Select top 1 salary from (select top 4 salary from tbl_emp
order by salary desc) temp_tbl order by asc

Is This Answer Correct ?    5 Yes 5 No

write query for fourth maximum salary from employee table..

Answer / dharmendra k. dixit

For Finding Nth Salary...

SELECT TOP 1 Salary FROM
(SELECT TOP nth Salary FROM Table Order by Salary Desc)Table
As Sal Order by Salary

Is This Answer Correct ?    5 Yes 5 No

write query for fourth maximum salary from employee table..

Answer / elumalai.k

select salary from employee aa
where 4=(select count(*)from employee bb
where aa.salary<=bb.salary)

Is This Answer Correct ?    4 Yes 4 No

write query for fourth maximum salary from employee table..

Answer / avanish kumar

if you have a table emp and you have to find fourth maximum
salary from emp table then you will have to write this
query.....

select top 1 sal from (select top 4 * from emp order by sal
desc) as sal order by sal

Is This Answer Correct ?    2 Yes 2 No

write query for fourth maximum salary from employee table..

Answer / pramod

Select Top 1 (Salary) from emp where salary not in
(select Top 3 (Salary) from emp order by salary desc)
order by salary desc

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More SQL Server Interview Questions

What do you mean by the term 'normalization'?

0 Answers   Tech Mahindra,


What is the order in which the sql query is executed?

0 Answers  


What are the differences between char and nchar in ms sql server?

0 Answers  


What are the benefits of filtered indexes?

0 Answers  


What is Lock table in SQL?

0 Answers   Wipro,


what are the types of indexes? : Sql server database administration

0 Answers  


What is sql language?

0 Answers  


how you can list all the tables in a database?

0 Answers  


Explain the dbcc pintable command when would you use it?

0 Answers  


What is an expensive query?

0 Answers  


What do you mean by recursive stored procedure?

0 Answers  


What is candidate key with example?

0 Answers  


Categories