write query for fourth maximum salary from employee table
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
Can we use where and having clause together?
What is precedence constraint?
What is a bit datatype?
Syntax to find the used space and free space of the Data file in a database(SQL Server). Following queries didn't give the exact Used space and Free Space Information sp_spaceused;DBCC showfilestats;exec MyDbName.dbo.sp_spaceused;SP_HELPFILE Can any one tell me the query for how to find the exact used data file space and free space in a Data File?
What is the difference between Triggers and Stored Procedure?
How many clustered indexes there can be on table ?
When I run the sql server 2000 setup, it just hangs. What do I do?
What is resource governor in sql server?
What is the difference between the application object and session object?
What is table join?
difference between select column name from table name where serviceid=2; and select max(column name) from table name where serviceid=2; IN ORACLE
What is the purpose of forms?