how to find nth highest salary
Answer Posted / nandkumar karlekar
Take this script and try u will get nth salary as you wish
create Table EmpTest
(
ID bigint,
Sal bigint
)
go
insert into emptest
values
(1,100)
insert into emptest
values
(2,200)
insert into emptest
values
(3,300)
insert into emptest
values
(4,400)
insert into emptest
values
(5,500)
insert into emptest
values
(6,600)
go
DECLARE @n bigint
--specify your nth salary
SET @n=3
select top 1 * from Emptest
where @n <= (select Count(*) from Emptest EE where EE.sal
>Emptest.sal)
order by sal desc
| Is This Answer Correct ? | 0 Yes | 3 No |
Post New Answer View All Answers
1.what is the diff between nolock optimizer and read uncommitted isolation? 2.what is the diff between revoke and deny? 3.what is percieved down time? 4.whether password protection are required for backups?if yes why?if no why? 5.what is fill factor? 6.what is cost analysis? 7.what is mean by piece meal restore? 8.what is 'rowguidcol'? 9.impersonate permission? 10.what is selectivity?
What guidelines should be followed to help minimize deadlocks?
How many servers can we create in a single subscription?
Do you know what is replace and stuff function in sql server?
If you want to send some data from access database to sql server database. What are different component of ssis will you use?
What is the maximum number of index per table?
Is candidate a key?
What is clustered vs nonclustered index?
How do you troubleshoot errors in a SQL Server Agent Job?
What is faster join or union?
Explain about local stored procedure?
in the physical file layout, where should the transaction log be stored in relation to the data file? : Sql server administration
What are the properties of the transaction?
What is failover clustering overview?
What are the differences between clustered and non-clustered index?