how to find nth highest salary
Answer Posted / amit
select * from emp as e1 where sal (n-1) = select distinct
(count(*) from emp as e2 where e2.sal>e1.sal)
Where n is no that u want which postion's salary u want
suppose second higest means n=2
Amit
Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
What is a table called, if it has neither cluster nor non-cluster index? What is it used for?
Write a sql query to sort on different column name according to the parameters passed in the function?
What is model database? : SQL Server Architecture
Why should one not prefix user stored procedures with ‘sp_’?
Define compound operators?
Is it important for a database administrator to understand the operating system and file access?
When would you use it?
How many types of schemas are there?
How to Improve the performencs of SQL Server 2005 exclude stored Procedure and Indexes?
Do you know hot add cpu in sql server 2008?
Explain indexing and what are the advantages of it?
What is the difference between a fill factor of 100 and 0?
What will happen if a column containing char type data is changed to the nchar data type?
What are the different types of upgrades that can be performed in sql server?
What is user-defined scalar function?