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 not null constraint?
What are null values in ms sql server?
What are types of subqueries?
Can you give me some DBCC command options?(Database consistency check) - DBCC CHECKDB - Ensures that tables in the db and the indexes are correctly linked.and DBCC CHECKALLOC - To check that all pages in a db are correctly allocated. DBCC SQLPERF - It gives report on current usage of transaction log in percentage. DBCC CHECKFILEGROUP - Checks all tables file group for any damage.
What is the difference between ‘having’ clause and a ‘where’ clause?
Suppose i have a table that contains 5 columns like col1,col2...colm5.I want to import only two column through BCP utility.How to do same through BCP in sybase.
How can we check the sql server version?
What is policy management?
When would you prefer to have a minimum number of indexes?
what are the different ways to return the rowcount of a table?
What is difference statement and preparedstatement?
what are different types of backups available in sql server? Given a particular scenario, how would you go about choosing a backup plan? : Sql server database administration
What is data source document?
Is it possible in sql table to have more than one foreign key?
How can you set the threshold at which sql server will generate keysets asynchronously?